@arcgis/core 4.28.0-next.20230720 → 4.28.0-next.20230721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Color.js +1 -1
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/lib/comment-handler.js +1 -1
- package/arcade/lib/parser.js +1 -1
- package/arcade/lib/scanner.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
- package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
- package/assets/esri/core/workers/chunks/{c13b332afdb3f6be1ec9.js → 092fda62b6f62c2e4869.js} +1 -1
- package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
- package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
- package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
- package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
- package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
- package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
- package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
- package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
- package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
- package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
- package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
- package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
- package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
- package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
- package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c026947505a9ff94a53.js → 807742f38885fa90b4fe.js} +1 -1
- package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
- package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
- package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
- package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
- package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
- package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
- package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
- package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
- package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
- package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
- package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
- package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
- package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
- package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
- package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
- package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
- package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
- package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
- package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
- package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
- package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
- package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
- package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
- package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
- package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
- package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
- package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/array.js +1 -1
- package/core/Collection.js +1 -1
- package/core/accessorSupport/decorators/subclass.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/get.js +1 -1
- package/core/accessorSupport/tracking.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/libs/rbush/PooledRBush.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/support/TileClipper.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +7 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/effects/EffectView.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/MultidimensionalSubset.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/TileInfoTilemapCache.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/pamParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/colormaps.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/layers/voxel/VoxelDimension.js +1 -1
- package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/support/generateRendererUtils.js +1 -1
- package/smartMapping/raster/renderers/classBreaks.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectArrow.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/flow/dataUtils.js +1 -1
- package/views/2d/engine/flow/utils.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
- package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
- package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/2d/layers/BaseLayerView2D.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
- package/views/2d/tiling/TileInfoView.js +1 -1
- package/views/2d/tiling/TileInfoViewPOT.js +1 -1
- package/views/2d/tiling/TileQueue.js +1 -1
- package/views/2d/tiling.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TilingScheme.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
- package/views/MapView.js +1 -1
- package/views/animation/pointToPoint/Path.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/webgl/ProgramCache.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
- package/widgets/BuildingExplorer/support/validation.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Histogram/HistogramViewModel.js +1 -1
- package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/colorRampUtils.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Legend/support/utils.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
- package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0210f4c2e1f3ed13041b.js +0 -1
- package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
- package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
- package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
- package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
- package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
- package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
- package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
- package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
- package/assets/esri/core/workers/chunks/4510a17839405146130b.js +0 -1
- package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
- package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
- package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
- package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
- package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
- package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
- package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
- package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
- package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
- package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
- package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
- package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
- package/assets/esri/core/workers/chunks/af4083f2aad5f5d49dde.js +0 -1
- package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
- package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
- package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
- package/assets/esri/core/workers/chunks/d5cce09fbe16cbb8fee4.js +0 -1
- package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
- package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
- package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
- package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
- package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
- package/views/2d/tiling/PagedTileQueue.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{watch as r,initial as n,on as a}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import u from"./VideoCameraSensorModel.js";import{VideoMetadataEntryId as d}from"./videoUtils.js";import{g as h,c,a as p}from"../../chunks/_commonjsHelpers.js";var m="undefined"!=typeof window?window:void 0!==c?c:"undefined"!=typeof self?self:{};const g=h(m);var f=require("./document.js");module.exports=new f;const y=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var _,b=void 0!==c?c:"undefined"!=typeof window?window:{},v=p(y);"undefined"!=typeof document?_=document:(_=b["__GLOBAL_DOCUMENT_CACHE@4"])||(_=b["__GLOBAL_DOCUMENT_CACHE@4"]=v);var T=_;const S=h(T);var E={exports:{}};E.exports,function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return a[e];var i,n=String(e);return(i=s[n.toLowerCase()])?i:(i=r[n.toLowerCase()])||(1===n.length?n.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var n;if(n=s[t.toLowerCase()])return n===i;if(n=r[t.toLowerCase()])return n===i}else if("number"==typeof t)return t===i;return!1}};var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a=t.names=t.title={};for(n in s)a[s[n]]=n;for(var o in r)s[o]=r[o]}(E,E.exports);const w=h(E.exports);function k(e,t){var i,s=null;try{i=JSON.parse(e,t)}catch(r){s=r}return[s,i]}const C=h(k);var x={exports:{}};function I(){return module.exports=I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},module.exports.__esModule=!0,module.exports.default=module.exports,I.apply(this,arguments)}module.exports=I,module.exports.__esModule=!0,module.exports.default=module.exports;const A=p(Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})));module.exports=L;var D=Object.prototype.toString;function L(e){if(!e)return!1;var t=D.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}const P=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var O=m;function N(e){return void 0===e&&(e=""),e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),s=i[0],r=i[1];return"charset"===s.trim()?r.trim():e}),"utf-8")}var R=function(e,t){return void 0===t&&(t=!1),function(i,s,r){if(i)e(i);else if(s.statusCode>=400&&s.statusCode<=599){var n=r;if(t)if(O.TextDecoder){var a=N(s.headers&&s.headers["content-type"]);try{n=new TextDecoder(a).decode(r)}catch(o){}}else n=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:n})}else e(null,r)}},M=m,U=A,B=p(P);V.httpHandler=R;var F=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),s=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[s]?t[s]=r:Array.isArray(t[s])?t[s].push(r):t[s]=[t[s],r]})),t):t};function j(e,t){for(var i=0;i<e.length;i++)t(e[i])}function q(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function $(e,t,i){var s=e;return B(t)?(i=t,"string"==typeof e&&(s={uri:e})):s=U({},t,{uri:e}),s.callback=i,s}function V(e,t,i){return H(t=$(e,t,i))}function H(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,s,r){t||(t=!0,e.callback(i,s,r))};function s(){4===u.readyState&&setTimeout(a,0)}function r(){var e=void 0;if(e=u.response?u.response:u.responseText||W(u),f)try{e=JSON.parse(e)}catch(t){}return e}function n(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,y)}function a(){if(!l){var t;clearTimeout(d),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var s=y,n=null;return 0!==t?(s={body:r(),statusCode:t,method:c,headers:{},url:h,rawRequest:u},u.getAllResponseHeaders&&(s.headers=F(u.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),i(n,s,s.body)}}var o,l,u=e.xhr||null;u||(u=e.cors||e.useXDR?new V.XDomainRequest:new V.XMLHttpRequest);var d,h=u.url=e.uri||e.url,c=u.method=e.method||"GET",p=e.body||e.data,m=u.headers=e.headers||{},g=!!e.sync,f=!1,y={body:void 0,headers:{},statusCode:0,method:c,url:h,rawRequest:u};if("json"in e&&!1!==e.json&&(f=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),u.onreadystatechange=s,u.onload=a,u.onerror=n,u.onprogress=function(){},u.onabort=function(){l=!0},u.ontimeout=n,u.open(c,h,!g,e.username,e.password),g||(u.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(d=setTimeout((function(){if(!l){l=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),u.setRequestHeader)for(o in m)m.hasOwnProperty(o)&&u.setRequestHeader(o,m[o]);else if(e.headers&&!q(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(p||null),u}function W(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(i){}return null}function G(){}x.exports=V,x.exports.default=V,V.XMLHttpRequest=M.XMLHttpRequest||G,V.XDomainRequest="withCredentials"in new V.XMLHttpRequest?V.XMLHttpRequest:M.XDomainRequest,j(["get","put","post","patch","head","delete"],(function(e){V["delete"===e?"del":e]=function(t,i,s){return(i=$(t,i,s)).method=e.toUpperCase(),H(i)}}));const z=h(x.exports);var X={exports:{}},K=T,Y=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function Q(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function J(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+(0|s)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Z(){this.values=Y(null)}function ee(e,t,i,s){var r=s?e.split(s):[e];for(var n in r)if("string"==typeof r[n]){var a=r[n].split(i);if(2===a.length)t(a[0].trim(),a[1].trim())}}function te(e,t,i){var s=e;function r(){var t=J(e);if(null===t)throw new Q(Q.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(e,t){var s=new Z;ee(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),a=n[0];s.integer(e,a),s.percent(e,a)&&s.set("snapToLines",!1),s.alt(e,a,["auto"]),2===n.length&&s.alt("lineAlign",n[1],["start","center","end"]);break;case"position":n=t.split(","),s.percent(e,n[0]),2===n.length&&s.alt("positionAlign",n[1],["start","center","end"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");try{t.line=s.get("line","auto")}catch(r){}t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100);try{t.align=s.get("align","center")}catch(r){t.align=s.get("align","middle")}try{t.position=s.get("position","auto")}catch(r){t.position=s.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=s.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Q(Q.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.substr(3),a(),t.endTime=r(),a(),n(e,t)}Q.prototype=Y(Error.prototype),Q.prototype.constructor=Q,Q.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Z.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ie=K.createElement&&K.createElement("textarea"),se={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},re={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)"},ne={v:"title",lang:"lang"},ae={rt:"ruby"};function oe(e,t){function i(){if(!t)return null;function e(e){return t=t.substr(e.length),e}var i=t.match(/^([^<]*)(<[^>]*>?)?/);return e(i[1]?i[1]:i[2])}function s(e){return ie.innerHTML=e,e=ie.textContent,ie.textContent="",e}function r(e,t){return!ae[t.localName]||ae[t.localName]===e.localName}function n(t,i){var s=se[t];if(!s)return null;var r=e.document.createElement(s),n=ne[t];return n&&i&&(r[n]=i.trim()),r}for(var a,o=e.document.createElement("div"),l=o,u=[];null!==(a=i());)if("<"!==a[0])l.appendChild(e.document.createTextNode(s(a)));else{if("/"===a[1]){u.length&&u[u.length-1]===a.substr(2).replace(">","")&&(u.pop(),l=l.parentNode);continue}var d,h=J(a.substr(1,a.length-2));if(h){d=e.document.createProcessingInstruction("timestamp",h),l.appendChild(d);continue}var c=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!c)continue;if(!(d=n(c[1],c[3])))continue;if(!r(l,d))continue;if(c[2]){var p=c[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(re.hasOwnProperty(i)){var s=t?"background-color":"color",r=re[i];d.style[s]=r}})),d.className=p.join(" ")}u.push(c[1]),l.appendChild(d),l=d}return o}var le=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function ue(e){for(var t=0;t<le.length;t++){var i=le[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function de(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function s(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var n=i.match(/^.*(\n|\r)/);return n?(e.length=0,n[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(s(e,t),r(e)):void 0}for(s(t,e);i=r(t);)for(var n=0;n<i.length;n++)if(ue(i.charCodeAt(n)))return"rtl";return"ltr"}function he(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&s++;return-1*++s}function ce(){}function pe(e,t,i){ce.call(this),this.cue=t,this.cueDiv=oe(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:de(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function me(e){var t,i,s,r;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,r=e.div.offsetTop;var n=(n=e.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();e=e.div.getBoundingClientRect(),t=n?Math.max(n[0]&&n[0].height||0,e.height/n.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||s,this.lineHeight=void 0!==t?t:e.lineHeight}function ge(e,t,i,s){function r(e,t){for(var r,n=new me(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(s);)e.move(t[o]);if(e.within(i))return e;var l=e.intersectPercentage(i);a>l&&(r=new me(e),a=l),e=new me(n)}return r||n}var n=new me(t),a=t.cue,o=he(a),l=[];if(a.snapToLines){var u;switch(a.vertical){case"":l=["+y","-y"],u="height";break;case"rl":l=["+x","-x"],u="width";break;case"lr":l=["-x","+x"],u="width"}var d=n.lineHeight,h=d*Math.round(o),c=i[u]+d,p=l[0];Math.abs(h)>c&&(h=h<0?-1:1,h*=Math.ceil(c/d)*d),o<0&&(h+=""===a.vertical?i.height:i.width,l=l.reverse()),n.move(p,h)}else{var m=n.lineHeight/i.height*100;switch(a.lineAlign){case"center":o-=m/2;break;case"end":o-=m}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")})}l=["+y","-x","+x","-y"],n=new me(t)}var g=r(n,l);t.move(g.toCSSCompatValues(i))}function fe(){}ce.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},ce.prototype.formatStyle=function(e,t){return 0===e?0:e+t},pe.prototype=Y(ce.prototype),pe.prototype.constructor=pe,me.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},me.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},me.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},me.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},me.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},me.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},me.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},me.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},fe.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},fe.convertCueToDOMTree=function(e,t){return e&&t?oe(e,t):null};var ye=.05,_e="sans-serif",be="1.5%";fe.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");function r(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin=be,i.appendChild(s),r(t)){var n=[],a=me.getSimpleBoxPosition(s),o={font:Math.round(a.height*ye*100)/100+"px "+_e};!function(){for(var i,r,l=0;l<t.length;l++)r=t[l],i=new pe(e,r,o),s.appendChild(i.div),ge(e,i,a,n),r.displayState=i.div,n.push(me.getSimpleBoxPosition(i))}()}else for(var l=0;l<t.length;l++)s.appendChild(t[l].displayState)},fe.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},fe.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof Q))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var s=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),s}function s(e){var i=new Z;if(ee(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var s=t.split(",");if(2!==s.length)break;var r=new Z;if(r.percent("x",s[0]),r.percent("y",s[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var s=new(t.vttjs.VTTRegion||t.window.VTTRegion);s.width=i.get("width",100),s.lines=i.get("lines",3),s.regionAnchorX=i.get("regionanchorX",0),s.regionAnchorY=i.get("regionanchorY",100),s.viewportAnchorX=i.get("viewportanchorX",0),s.viewportAnchorY=i.get("viewportanchorY",100),s.scroll=i.get("scroll",""),t.onregion&&t.onregion(s),t.regionList.push({id:i.get("id"),region:s})}}function r(e){var i=new Z;ee(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",J(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}function n(e){e.match(/X-TIMESTAMP-MAP/)?ee(e,(function(e,t){if("X-TIMESTAMP-MAP"===e)r(t)}),/=/):ee(e,(function(e,t){if("Region"===e)s(t)}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var a;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var o=(a=i()).match(/^WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new Q(Q.Errors.BadSignature);t.state="HEADER"}for(var l=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(l?l=!1:a=i(),t.state){case"HEADER":/:/.test(a)?n(a):a||(t.state="ID");continue;case"NOTE":a||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){t.state="NOTE";break}if(!a)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(d){t.cue.align="middle"}if(t.state="CUE",-1===a.indexOf("--\x3e")){t.cue.id=a;continue}case"CUE":try{te(a,t.cue,t.regionList)}catch(d){t.reportOrThrowError(d),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var u=-1!==a.indexOf("--\x3e");if(!a||u&&(l=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=a.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":a||(t.state="ID");continue}}}catch(d){t.reportOrThrowError(d),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Q(Q.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var ve=fe,Te="auto",Se={"":1,lr:1,rl:1},Ee={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function we(e){return"string"==typeof e&&(!!Se[e.toLowerCase()]&&e.toLowerCase())}function ke(e){return"string"==typeof e&&(!!Ee[e.toLowerCase()]&&e.toLowerCase())}function Ce(e,t,i){this.hasBeenReset=!1;var s="",r=!1,n=e,a=t,o=i,l=null,u="",d=!0,h="auto",c="start",p="auto",m="auto",g=100,f="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(e){s=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");n=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var t=we(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return d},set:function(e){d=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&e!==Te)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){var t=ke(e);t?(c=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(e){var t=ke(e);t?(m=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");g=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return f},set:function(e){var t=ke(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");f=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ce.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var xe=Ce,Ie={"":!0,up:!0};function Ae(e){return"string"==typeof e&&(!!Ie[e.toLowerCase()]&&e.toLowerCase())}function De(e){return"number"==typeof e&&e>=0&&e<=100}function Le(){var e=100,t=3,i=0,s=100,r=0,n=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!De(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!De(e))throw new Error("RegionAnchorX must be between 0 and 100.");s=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!De(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!De(e))throw new Error("ViewportAnchorY must be between 0 and 100.");n=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!De(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return a},set:function(e){var t=Ae(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):a=t}}})}var Pe=Le,Oe=m,Ne=X.exports={WebVTT:ve,VTTCue:xe,VTTRegion:Pe};Oe.vttjs=Ne,Oe.WebVTT=Ne.WebVTT;var Re=Ne.VTTCue,Me=Ne.VTTRegion,Ue=Oe.VTTCue,Be=Oe.VTTRegion;Ne.shim=function(){Oe.VTTCue=Re,Oe.VTTRegion=Me},Ne.restore=function(){Oe.VTTCue=Ue,Oe.VTTRegion=Be},Oe.VTTCue||Ne.shim();const Fe=h(X.exports);var je={exports:{}};je.exports,function(e,t){!function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var n=a.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return i.alwaysNormalize?(n.path=a.normalizePath(n.path),a.buildURLFromParts(n)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=s.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(u.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,h=d.substring(0,d.lastIndexOf("/")+1)+n.path;u.path=a.normalizePath(h)}else u.path=o.path,n.params||(u.params=o.params,n.query||(u.query=o.query));return null===u.path&&(u.path=i.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=a}()}(je,je.exports);const qe=h(je.exports);var $e="http://example.com",Ve=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=g.location&&g.location.href||"");var i="function"==typeof g.URL,s=/^\/\//.test(e),r=!g.location&&!/\/\//i.test(e);if(i?e=new g.URL(e,g.location||$e):/\/\//i.test(e)||(e=qe.buildAbsoluteURL(g.location&&g.location.href||"",e)),i){var n=new URL(t,e);return r?n.href.slice($e.length):s?n.href.slice(n.protocol.length):n.href}return qe.buildAbsoluteURL(e,t)};function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},He.apply(this,arguments)}var We=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),Ge=function(e){return g.atob?g.atob(e):Buffer.from(e,"base64").toString("binary")};function ze(e){for(var t=Ge(e),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}class Xe extends We{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Ke=String.fromCharCode(9),Ye=function(e){const t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},Qe=function(){return new RegExp("(?:^|,)("+("(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")")+")")},Je=function(e){const t={};if(!e)return t;const i=e.split(Qe());let s,r=i.length;for(;r--;)""!==i[r]&&(s=/([^=]*)=(.*)/.exec(i[r]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),t[s[0]]=s[1]);return t};class Ze extends We{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(0===(e=e.trim()).length)return;if("#"!==e[0])return void this.trigger("data",{type:"uri",uri:e});this.tagMappers.reduce(((t,i)=>{const s=i(e);return s===e?t:t.concat([s])}),[e]).forEach((e=>{for(let t=0;t<this.customParsers.length;t++)if(this.customParsers[t].call(this,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e),t)this.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e),t)return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void this.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void this.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(e),t)return i=He(Ye(t[1]),{type:"tag",tagType:"byterange"}),void this.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e),t)return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-MAP:(.*)$/.exec(e),t){if(i={type:"tag",tagType:"map"},t[1]){const e=Je(t[1]);e.URI&&(i.uri=e.URI),e.BYTERANGE&&(i.byterange=Ye(e.BYTERANGE))}this.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(e),t){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=Je(t[1]),i.attributes.RESOLUTION){const e=i.attributes.RESOLUTION.split("x"),t={};e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),i.attributes.RESOLUTION=t}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}this.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:(.*)$/.exec(e),t)return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Je(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e),t)this.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e),t)this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e),t)return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-KEY:(.*)$/.exec(e),t)return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Je(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void this.trigger("data",i);if(t=/^#EXT-X-START:(.*)$/.exec(e),t)return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Je(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-IN:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-SKIP:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"skip"},i.attributes=Je(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(Ke)),void this.trigger("data",i);if(t=/^#EXT-X-PART:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"part"},i.attributes=Je(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Ye(i.attributes.BYTERANGE)),void this.trigger("data",i);if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"server-control"},i.attributes=Je(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void this.trigger("data",i);if(t=/^#EXT-X-PART-INF:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"part-inf"},i.attributes=Je(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void this.trigger("data",i);if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"preload-hint"},i.attributes=Je(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){if(i.attributes.hasOwnProperty(e)){i.attributes[e]=parseInt(i.attributes[e],10);const t="BYTERANGE-LENGTH"===e?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e]}})),void this.trigger("data",i);if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"rendition-report"},i.attributes=Je(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void this.trigger("data",i);if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(e),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=Je(t[1]),["ID","CLASS"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=String(i.attributes[e]))})),["START-DATE","END-DATE"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=new Date(i.attributes[e]))})),["DURATION","PLANNED-DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["END-ON-NEXT"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/i.test(i.attributes[e]))})),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=i.attributes[e].toString(16))}));const e=/^X-([A-Z]+-)+[A-Z]+$/;for(const t in i.attributes){if(!e.test(t))continue;const s=/[0-9A-Fa-f]{6}/g.test(i.attributes[t]),r=/^\d+(\.\d+)?$/.test(i.attributes[t]);i.attributes[t]=s?i.attributes[t].toString(16):r?parseFloat(i.attributes[t]):String(i.attributes[t])}this.trigger("data",i)}else t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e),t?this.trigger("data",{type:"tag",tagType:"independent-segments"}):this.trigger("data",{type:"tag",data:e.slice(4)})}}}else this.trigger("data",{type:"comment",text:e.slice(1)})}))}addParser({expression:e,customType:t,dataParser:i,segment:s}){"function"!=typeof i&&(i=e=>e),this.customParsers.push((r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:s}),!0}))}addTagMapper({expression:e,map:t}){const i=i=>e.test(i)?t(i):i;this.tagMappers.push(i)}}const et=e=>e.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase())),tt=function(e){const t={};return Object.keys(e).forEach((function(i){t[et(i)]=e[i]})),t},it=function(e){const{serverControl:t,targetDuration:i,partTargetDuration:s}=e;if(!t)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=i&&3*i,l=s&&2*s;i&&!t.hasOwnProperty(n)&&(t[n]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[n]<o&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${t[n]}) to targetDuration * 3 (${o})`}),t[n]=o),s&&!t.hasOwnProperty(a)&&(t[a]=3*s,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${t[a]}).`})),s&&t[a]<l&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${t[a]}) to partTargetDuration * 2 (${l}).`}),t[a]=l)};class st extends We{constructor(){super(),this.lineStream=new Xe,this.parseStream=new Ze,this.lineStream.pipe(this.parseStream);const e=this,t=[];let i,s,r={},n=!1;const a=function(){},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let u=0;this.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};let d=0,h=0;const c={};this.on("end",(()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&s&&(r.key=s),r.timeline||"number"!=typeof u||(r.timeline=u),this.manifest.preloadSegment=r)})),this.parseStream.on("data",(function(p){let m,g;({tag(){({version(){p.version&&(this.manifest.version=p.version)},"allow-cache"(){this.manifest.allowCache=p.allowed,"allowed"in p||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const e={};"length"in p&&(r.byterange=e,e.length=p.length,"offset"in p||(p.offset=d)),"offset"in p&&(r.byterange=e,e.offset=p.offset),d=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),p.duration>0&&(r.duration=p.duration),0===p.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(p.attributes)if("NONE"!==p.attributes.METHOD)if(p.attributes.URI){if("com.apple.streamingkeydelivery"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:p.attributes});if("com.microsoft.playready"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:p.attributes.URI});if(p.attributes.KEYFORMAT===l){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(p.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===p.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==p.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):p.attributes.KEYID&&"0x"===p.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:p.attributes.KEYFORMAT,keyId:p.attributes.KEYID.substring(2)},pssh:ze(p.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}p.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:p.attributes.METHOD||"AES-128",uri:p.attributes.URI},void 0!==p.attributes.IV&&(s.iv=p.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else s=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(p.number)?this.manifest.mediaSequence=p.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+p.number})},"discontinuity-sequence"(){isFinite(p.number)?(this.manifest.discontinuitySequence=p.number,u=p.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+p.number})},"playlist-type"(){/VOD|EVENT/.test(p.playlistType)?this.manifest.playlistType=p.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+p.playlist})},map(){i={},p.uri&&(i.uri=p.uri),p.byterange&&(i.byterange=p.byterange),s&&(i.key=s)},"stream-inf"(){this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||o,p.attributes?(r.attributes||(r.attributes={}),He(r.attributes,p.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,!(p.attributes&&p.attributes.TYPE&&p.attributes["GROUP-ID"]&&p.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const e=this.manifest.mediaGroups[p.attributes.TYPE];e[p.attributes["GROUP-ID"]]=e[p.attributes["GROUP-ID"]]||{},m=e[p.attributes["GROUP-ID"]],g={default:/yes/i.test(p.attributes.DEFAULT)},g.default?g.autoselect=!0:g.autoselect=/yes/i.test(p.attributes.AUTOSELECT),p.attributes.LANGUAGE&&(g.language=p.attributes.LANGUAGE),p.attributes.URI&&(g.uri=p.attributes.URI),p.attributes["INSTREAM-ID"]&&(g.instreamId=p.attributes["INSTREAM-ID"]),p.attributes.CHARACTERISTICS&&(g.characteristics=p.attributes.CHARACTERISTICS),p.attributes.FORCED&&(g.forced=/yes/i.test(p.attributes.FORCED)),m[p.attributes.NAME]=g},discontinuity(){u+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=p.dateTimeString,this.manifest.dateTimeObject=p.dateTimeObject),r.dateTimeString=p.dateTimeString,r.dateTimeObject=p.dateTimeObject},targetduration(){!isFinite(p.duration)||p.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+p.duration}):(this.manifest.targetDuration=p.duration,it.call(this,this.manifest))},start(){p.attributes&&!isNaN(p.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:p.attributes["TIME-OFFSET"],precise:p.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){r.cueOut=p.data},"cue-out-cont"(){r.cueOutCont=p.data},"cue-in"(){r.cueIn=p.data},skip(){this.manifest.skip=tt(p.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",p.attributes,["SKIPPED-SEGMENTS"])},part(){n=!0;const e=this.manifest.segments.length,t=tt(p.attributes);r.parts=r.parts||[],r.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=h),h=t.byterange.offset+t.byterange.length);const i=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${e}`,p.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const e=this.manifest.serverControl=tt(p.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),it.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const e=this.manifest.segments.length,t=tt(p.attributes),i=t.type&&"PART"===t.type;r.preloadHints=r.preloadHints||[],r.preloadHints.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?h:0,i&&(h=t.byterange.offset+t.byterange.length)));const s=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #${e}`,p.attributes,["TYPE","URI"]),t.type)for(let n=0;n<r.preloadHints.length-1;n++){const i=r.preloadHints[n];i.type&&(i.type===t.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${s} for segment #${e} has the same TYPE ${t.type} as preload hint #${n}`}))}},"rendition-report"(){const e=tt(p.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(e);const t=this.manifest.renditionReports.length-1,i=["LAST-MSN","URI"];n&&i.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${t}`,p.attributes,i)},"part-inf"(){this.manifest.partInf=tt(p.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",p.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),it.call(this,this.manifest)},daterange(){this.manifest.daterange=this.manifest.daterange||[],this.manifest.daterange.push(tt(p.attributes));const e=this.manifest.daterange.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${e}`,p.attributes,["ID","START-DATE"]);const t=this.manifest.daterange[e];t.endDate&&t.startDate&&new Date(t.endDate)<new Date(t.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),t.duration&&t.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),t.plannedDuration&&t.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const i=!!t.endOnNext;if(i&&!t.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),i&&(t.duration||t.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),t.duration&&t.endDate){const i=t.startDate,s=i.setSeconds(i.getSeconds()+t.duration);this.manifest.daterange[e].endDate=new Date(s)}if(t&&!this.manifest.dateTimeString&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),c[t.id]){for(const s in c[t.id])if(c[t.id][s]!==t[s]){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes and same attribute values"});break}}else c[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0}}[p.tagType]||a).call(e)},uri(){r.uri=p.uri,t.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),s&&(r.key=s),r.timeline=u,i&&(r.map=i),h=0,r={}},comment(){},custom(){p.segment?(r.custom=r.custom||{},r.custom[p.customType]=p.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[p.customType]=p.data)}})[p.type].call(e)}))}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach((function(e){t.hasOwnProperty(e)||s.push(e)})),s.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var rt,nt,at={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},ot=["video","audio","text"],lt=["Video","Audio","Text"],ut=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},dt=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),ot.forEach((function(s){var r=at[s].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=s;var n=e.substring(0,r[1].length),a=e.replace(n,"");i.push({type:n,details:a,mediaType:s})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},ht=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var s in i){var r=i[s];if(r.default&&r.playlists)return dt(r.playlists[0].attributes.CODECS)}return null},ct=function(e){return void 0===e&&(e=""),at.audio.test(e.trim().toLowerCase())},pt=function(e){return void 0===e&&(e=""),at.text.test(e.trim().toLowerCase())},mt=function(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map((function(e){return ut(e.trim())})),i="video";1===t.length&&ct(t[0])?i="audio":1===t.length&&pt(t[0])&&(i="application");var s="mp4";return t.every((function(e){return at.mp4.test(e)}))?s="mp4":t.every((function(e){return at.webm.test(e)}))?s="webm":t.every((function(e){return at.ogg.test(e)}))&&(s="ogg"),i+"/"+s+';codecs="'+e+'"'}},gt=function(e){return void 0===e&&(e=""),g.MediaSource&&g.MediaSource.isTypeSupported&&g.MediaSource.isTypeSupported(mt(e))||!1},ft=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<lt.length;t++){var i=lt[t];if(at["muxer"+i].test(e))return!0}return!1}))},yt="mp4a.40.2",_t="avc1.4d400d",bt=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,vt=/^application\/dash\+xml/i,Tt=function(e){return bt.test(e)?"hls":vt.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},St=function(e){return e.toString(2).length},Et=function(e){return Math.ceil(St(e)/8)},wt=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},kt=function(e){return wt(e)},Ct=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||kt(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},xt=g.BigInt||Number,It=[xt("0x1"),xt("0x100"),xt("0x10000"),xt("0x1000000"),xt("0x100000000"),xt("0x10000000000"),xt("0x1000000000000"),xt("0x100000000000000"),xt("0x10000000000000000")];rt=new Uint16Array([65484]),255===(nt=new Uint8Array(rt.buffer,rt.byteOffset,rt.byteLength))[0]||nt[0];var At=function(e,t){var i=void 0===t?{}:t,s=i.signed,r=void 0!==s&&s,n=i.le,a=void 0!==n&&n;e=Ct(e);var o=a?"reduce":"reduceRight",l=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,s){var r=a?s:Math.abs(s+1-e.length);return t+xt(i)*It[r]}),xt(0));if(r){var u=It[e.length]/xt(2)-xt(1);(l=xt(l))>u&&(l-=u,l-=u,l-=xt(2))}return Number(l)},Dt=function(e,t){var i=(void 0===t?{}:t).le,s=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=xt(e);for(var r=Et(e),n=new Uint8Array(new ArrayBuffer(r)),a=0;a<r;a++){var o=s?a:Math.abs(a+1-n.length);n[o]=Number(e/It[a]&xt(255)),e<0&&(n[o]=Math.abs(~n[o]),n[o]-=0===a?1:2)}return n},Lt=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i},Pt=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e})),t.length<=1)return Ct(t[0]);var s=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(s),n=0;return t.forEach((function(e){e=Ct(e),r.set(e,n),n+=e.byteLength})),r},Ot=function(e,t,i){var s=void 0===i?{}:i,r=s.offset,n=void 0===r?0:r,a=s.mask,o=void 0===a?[]:a;e=Ct(e);var l=(t=Ct(t)).every?t.every:Array.prototype.every;return t.length&&e.length-n>=t.length&&l.call(t,(function(t,i){return t===(o[i]?o[i]&e[n+i]:e[n+i])}))},Nt="http://example.com",Rt=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=g.location&&g.location.href||"");var i="function"==typeof g.URL,s=/^\/\//.test(e),r=!g.location&&!/\/\//i.test(e);if(i?e=new g.URL(e,g.location||Nt):/\/\//i.test(e)||(e=qe.buildAbsoluteURL(g.location&&g.location.href||"",e)),i){var n=new URL(t,e);return r?n.href.slice(Nt.length):s?n.href.slice(n.protocol.length):n.href}return qe.buildAbsoluteURL(e,t)},Mt=function(e,t,i){t.forEach((function(t){for(var s in e.mediaGroups[t])for(var r in e.mediaGroups[t][s]){var n=e.mediaGroups[t][s][r];i(n,t,s,r)}}))},Ut=function(e){return g.atob?g.atob(e):Buffer.from(e,"base64").toString("binary")};function Bt(e){for(var t=Ut(e),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}var Ft={},jt={};function qt(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];if(t.call(void 0,r,s,e))return r}}function $t(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}function Vt(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}var Ht=$t({HTML:"text/html",isHTML:function(e){return e===Ht.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Wt=$t({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Wt.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});jt.assign=Vt,jt.find=qt,jt.freeze=$t,jt.MIME_TYPE=Ht,jt.NAMESPACE=Wt;var Gt=jt,zt=Gt.find,Xt=Gt.NAMESPACE;function Kt(e){return""!==e}function Yt(e){return e?e.split(/[\t\n\f\r ]+/).filter(Kt):[]}function Qt(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Jt(e){if(!e)return[];var t=Yt(e);return Object.keys(t.reduce(Qt,{}))}function Zt(e){return function(t){return e&&-1!==e.indexOf(t)}}function ei(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function ti(e,t){var i=e.prototype;if(!(i instanceof t)){function s(){}s.prototype=t.prototype,ei(i,s=new s),e.prototype=i=s}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var ii={},si=ii.ELEMENT_NODE=1,ri=ii.ATTRIBUTE_NODE=2,ni=ii.TEXT_NODE=3,ai=ii.CDATA_SECTION_NODE=4,oi=ii.ENTITY_REFERENCE_NODE=5,li=ii.ENTITY_NODE=6,ui=ii.PROCESSING_INSTRUCTION_NODE=7,di=ii.COMMENT_NODE=8,hi=ii.DOCUMENT_NODE=9,ci=ii.DOCUMENT_TYPE_NODE=10,pi=ii.DOCUMENT_FRAGMENT_NODE=11,mi=ii.NOTATION_NODE=12,gi={},fi={};gi.INDEX_SIZE_ERR=(fi[1]="Index size error",1),gi.DOMSTRING_SIZE_ERR=(fi[2]="DOMString size error",2);var yi=gi.HIERARCHY_REQUEST_ERR=(fi[3]="Hierarchy request error",3);gi.WRONG_DOCUMENT_ERR=(fi[4]="Wrong document",4),gi.INVALID_CHARACTER_ERR=(fi[5]="Invalid character",5),gi.NO_DATA_ALLOWED_ERR=(fi[6]="No data allowed",6),gi.NO_MODIFICATION_ALLOWED_ERR=(fi[7]="No modification allowed",7);var _i=gi.NOT_FOUND_ERR=(fi[8]="Not found",8);gi.NOT_SUPPORTED_ERR=(fi[9]="Not supported",9);var bi=gi.INUSE_ATTRIBUTE_ERR=(fi[10]="Attribute in use",10);function vi(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,fi[e]),this.message=fi[e],Error.captureStackTrace&&Error.captureStackTrace(this,vi);return i.code=e,t&&(this.message=this.message+": "+t),i}function Ti(){}function Si(e,t){this._node=e,this._refresh=t,Ei(this)}function Ei(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var i=e._refresh(e._node);ms(e,"length",i.length),ei(i,e),e._inc=t}}function wi(){}function ki(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function Ci(e,t,i,s){if(s?t[ki(t,s)]=i:t[t.length++]=i,e){i.ownerElement=e;var r=e.ownerDocument;r&&(s&&Ni(r,e,s),Oi(r,e,i))}}function xi(e,t,i){var s=ki(t,i);if(!(s>=0))throw new vi(_i,new Error(e.tagName+"@"+i));for(var r=t.length-1;s<r;)t[s]=t[++s];if(t.length=r,e){var n=e.ownerDocument;n&&(Ni(n,e,i),i.ownerElement=null)}}function Ii(){}function Ai(){}function Di(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Li(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Li(e,t))return!0}while(e=e.nextSibling)}function Pi(){this.ownerDocument=this}function Oi(e,t,i){e&&e._inc++,i.namespaceURI===Xt.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}function Ni(e,t,i,s){e&&e._inc++,i.namespaceURI===Xt.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Ri(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)s[n++]=r,r=r.nextSibling;s.length=n,delete s[s.length]}}}function Mi(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ri(e.ownerDocument,e),t}function Ui(e){return e&&(e.nodeType===Ai.DOCUMENT_NODE||e.nodeType===Ai.DOCUMENT_FRAGMENT_NODE||e.nodeType===Ai.ELEMENT_NODE)}function Bi(e){return e&&(ji(e)||qi(e)||Fi(e)||e.nodeType===Ai.DOCUMENT_FRAGMENT_NODE||e.nodeType===Ai.COMMENT_NODE||e.nodeType===Ai.PROCESSING_INSTRUCTION_NODE)}function Fi(e){return e&&e.nodeType===Ai.DOCUMENT_TYPE_NODE}function ji(e){return e&&e.nodeType===Ai.ELEMENT_NODE}function qi(e){return e&&e.nodeType===Ai.TEXT_NODE}function $i(e,t){var i=e.childNodes||[];if(zt(i,ji)||Fi(t))return!1;var s=zt(i,Fi);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function Vi(e,t){var i=e.childNodes||[];function s(e){return ji(e)&&e!==t}if(zt(i,s))return!1;var r=zt(i,Fi);return!(t&&r&&i.indexOf(r)>i.indexOf(t))}function Hi(e,t,i){if(!Ui(e))throw new vi(yi,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new vi(_i,"child not in parent");if(!Bi(t)||Fi(t)&&e.nodeType!==Ai.DOCUMENT_NODE)throw new vi(yi,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Wi(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ai.DOCUMENT_FRAGMENT_NODE){var n=r.filter(ji);if(n.length>1||zt(r,qi))throw new vi(yi,"More than one element or text in fragment");if(1===n.length&&!$i(e,i))throw new vi(yi,"Element in fragment can not be inserted before doctype")}if(ji(t)&&!$i(e,i))throw new vi(yi,"Only one element can be added and only after doctype");if(Fi(t)){if(zt(s,Fi))throw new vi(yi,"Only one doctype is allowed");var a=zt(s,ji);if(i&&s.indexOf(a)<s.indexOf(i))throw new vi(yi,"Doctype can only be inserted before an element");if(!i&&a)throw new vi(yi,"Doctype can not be appended since element is present")}}function Gi(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ai.DOCUMENT_FRAGMENT_NODE){var n=r.filter(ji);if(n.length>1||zt(r,qi))throw new vi(yi,"More than one element or text in fragment");if(1===n.length&&!Vi(e,i))throw new vi(yi,"Element in fragment can not be inserted before doctype")}if(ji(t)&&!Vi(e,i))throw new vi(yi,"Only one element can be added and only after doctype");if(Fi(t)){function a(e){return Fi(e)&&e!==i}if(zt(s,a))throw new vi(yi,"Only one doctype is allowed");var o=zt(s,ji);if(i&&s.indexOf(o)<s.indexOf(i))throw new vi(yi,"Doctype can only be inserted before an element")}}function zi(e,t,i,s){Hi(e,t,i),e.nodeType===Ai.DOCUMENT_NODE&&(s||Wi)(e,t,i);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===pi){var n=t.firstChild;if(null==n)return t;var a=t.lastChild}else n=a=t;var o=i?i.previousSibling:e.lastChild;n.previousSibling=o,a.nextSibling=i,o?o.nextSibling=n:e.firstChild=n,null==i?e.lastChild=a:i.previousSibling=a;do{n.parentNode=e}while(n!==a&&(n=n.nextSibling));return Ri(e.ownerDocument||e,e),t.nodeType==pi&&(t.firstChild=t.lastChild=null),t}function Xi(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,Ri(e.ownerDocument,e,t),t}function Ki(){this._nsMap={}}function Yi(){}function Qi(){}function Ji(){}function Zi(){}function es(){}function ts(){}function is(){}function ss(){}function rs(){}function ns(){}function as(){}function os(){}function ls(e,t){var i=[],s=9==this.nodeType&&this.documentElement||this,r=s.prefix,n=s.namespaceURI;if(n&&null==r&&null==(r=s.lookupPrefix(n)))var a=[{namespace:n,prefix:null}];return hs(this,i,e,t,a),i.join("")}function us(e,t,i){var s=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===s&&r===Xt.XML||r===Xt.XMLNS)return!1;for(var n=i.length;n--;){var a=i[n];if(a.prefix===s)return a.namespace!==r}return!0}function ds(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,Di),'"')}function hs(e,t,i,s,r){if(r||(r=[]),s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case si:var n=e.attributes,a=n.length,o=e.firstChild,l=e.tagName,u=l;if(!(i=Xt.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var d,h=0;h<n.length;h++)if("xmlns"===n.item(h).name){d=n.item(h).value;break}if(!d)for(var c=r.length-1;c>=0;c--){if(""===(p=r[c]).prefix&&p.namespace===e.namespaceURI){d=p.namespace;break}}if(d!==e.namespaceURI)for(c=r.length-1;c>=0;c--){var p;if((p=r[c]).namespace===e.namespaceURI){p.prefix&&(u=p.prefix+":"+l);break}}}t.push("<",u);for(var m=0;m<a;m++){"xmlns"==(g=n.item(m)).prefix?r.push({prefix:g.localName,namespace:g.value}):"xmlns"==g.nodeName&&r.push({prefix:"",namespace:g.value})}for(m=0;m<a;m++){var g,f,y;if(us(g=n.item(m),i,r))ds(t,(f=g.prefix||"")?"xmlns:"+f:"xmlns",y=g.namespaceURI),r.push({prefix:f,namespace:y});hs(g,t,i,s,r)}if(l===u&&us(e,i,r))ds(t,(f=e.prefix||"")?"xmlns:"+f:"xmlns",y=e.namespaceURI),r.push({prefix:f,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):hs(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)hs(o,t,i,s,r.slice()),o=o.nextSibling;t.push("</",u,">")}else t.push("/>");return;case hi:case pi:for(o=e.firstChild;o;)hs(o,t,i,s,r.slice()),o=o.nextSibling;return;case ri:return ds(t,e.name,e.value);case ni:return t.push(e.data.replace(/[<&>]/g,Di));case ai:return t.push("<![CDATA[",e.data,"]]>");case di:return t.push("\x3c!--",e.data,"--\x3e");case ci:var _=e.publicId,b=e.systemId;if(t.push("<!DOCTYPE ",e.name),_)t.push(" PUBLIC ",_),b&&"."!=b&&t.push(" ",b),t.push(">");else if(b&&"."!=b)t.push(" SYSTEM ",b,">");else{var v=e.internalSubset;v&&t.push(" [",v,"]"),t.push(">")}return;case ui:return t.push("<?",e.target," ",e.data,"?>");case oi:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function cs(e,t,i){var s;switch(t.nodeType){case si:(s=t.cloneNode(!1)).ownerDocument=e;case pi:break;case ri:i=!0}if(s||(s=t.cloneNode(!1)),s.ownerDocument=e,s.parentNode=null,i)for(var r=t.firstChild;r;)s.appendChild(cs(e,r,i)),r=r.nextSibling;return s}function ps(e,t,i){var s=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];"object"!=typeof n&&n!=s[r]&&(s[r]=n)}switch(t.childNodes&&(s.childNodes=new Ti),s.ownerDocument=e,s.nodeType){case si:var a=t.attributes,o=s.attributes=new wi,l=a.length;o._ownerElement=s;for(var u=0;u<l;u++)s.setAttributeNode(ps(e,a.item(u),!0));break;case ri:i=!0}if(i)for(var d=t.firstChild;d;)s.appendChild(ps(e,d,i)),d=d.nextSibling;return s}function ms(e,t,i){e[t]=i}gi.INVALID_STATE_ERR=(fi[11]="Invalid state",11),gi.SYNTAX_ERR=(fi[12]="Syntax error",12),gi.INVALID_MODIFICATION_ERR=(fi[13]="Invalid modification",13),gi.NAMESPACE_ERR=(fi[14]="Invalid namespace",14),gi.INVALID_ACCESS_ERR=(fi[15]="Invalid access",15),vi.prototype=Error.prototype,ei(gi,vi),Ti.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],s=0;s<this.length;s++)hs(this[s],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},Si.prototype.item=function(e){return Ei(this),this[e]},ti(Si,Ti),wi.prototype={length:0,item:Ti.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new vi(bi);var i=this.getNamedItem(e.nodeName);return Ci(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new vi(bi);return t=this.getNamedItemNS(e.namespaceURI,e.localName),Ci(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return xi(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return xi(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var s=this[i];if(s.localName==t&&s.namespaceURI==e)return s}return null}},Ii.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var s=new Pi;if(s.implementation=this,s.childNodes=new Ti,s.doctype=i||null,i&&s.appendChild(i),t){var r=s.createElementNS(e,t);s.appendChild(r)}return s},createDocumentType:function(e,t,i){var s=new ts;return s.name=e,s.nodeName=e,s.publicId=t||"",s.systemId=i||"",s}},Ai.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return zi(this,e,t)},replaceChild:function(e,t){zi(this,e,t,Gi),t&&this.removeChild(t)},removeChild:function(e){return Mi(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ps(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==ni&&e.nodeType==ni?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s;t=t.nodeType==ri?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==ri?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},ei(ii,Ai),ei(ii,Ai.prototype),Pi.prototype={nodeName:"#document",nodeType:hi,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==pi){for(var i=e.firstChild;i;){var s=i.nextSibling;this.insertBefore(i,t),i=s}return e}return zi(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===si&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Mi(this,e)},replaceChild:function(e,t){zi(this,e,t,Gi),e.ownerDocument=this,t&&this.removeChild(t),ji(e)&&(this.documentElement=e)},importNode:function(e,t){return cs(this,e,t)},getElementById:function(e){var t=null;return Li(this.documentElement,(function(i){if(i.nodeType==si&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=Jt(e);return new Si(this,(function(i){var s=[];return t.length>0&&Li(i.documentElement,(function(r){if(r!==i&&r.nodeType===si){var n=r.getAttribute("class");if(n){var a=e===n;if(!a){var o=Jt(n);a=t.every(Zt(o))}a&&s.push(r)}}})),s}))},createElement:function(e){var t=new Ki;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Ti,(t.attributes=new wi)._ownerElement=t,t},createDocumentFragment:function(){var e=new ns;return e.ownerDocument=this,e.childNodes=new Ti,e},createTextNode:function(e){var t=new Ji;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Zi;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new es;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new as;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Yi;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new rs;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Ki,s=t.split(":"),r=i.attributes=new wi;return i.childNodes=new Ti,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new Yi,s=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,i}},ti(Pi,Ai),Ki.prototype={nodeType:si,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===pi?this.insertBefore(e,null):Xi(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var s=this.ownerDocument.createAttributeNS(e,t);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Si(this,(function(t){var i=[];return Li(t,(function(s){s===t||s.nodeType!=si||"*"!==e&&s.tagName!=e||i.push(s)})),i}))},getElementsByTagNameNS:function(e,t){return new Si(this,(function(i){var s=[];return Li(i,(function(r){r===i||r.nodeType!==si||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||s.push(r)})),s}))}},Pi.prototype.getElementsByTagName=Ki.prototype.getElementsByTagName,Pi.prototype.getElementsByTagNameNS=Ki.prototype.getElementsByTagNameNS,ti(Ki,Ai),Yi.prototype.nodeType=ri,ti(Yi,Ai),Qi.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(fi[yi])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},ti(Qi,Ai),Ji.prototype={nodeName:"#text",nodeType:ni,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var s=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},ti(Ji,Qi),Zi.prototype={nodeName:"#comment",nodeType:di},ti(Zi,Qi),es.prototype={nodeName:"#cdata-section",nodeType:ai},ti(es,Qi),ts.prototype.nodeType=ci,ti(ts,Ai),is.prototype.nodeType=mi,ti(is,Ai),ss.prototype.nodeType=li,ti(ss,Ai),rs.prototype.nodeType=oi,ti(rs,Ai),ns.prototype.nodeName="#document-fragment",ns.prototype.nodeType=pi,ti(ns,Ai),as.prototype.nodeType=ui,ti(as,Ai),os.prototype.serializeToString=function(e,t,i){return ls.call(e,t,i)},Ai.prototype.toString=ls;try{if(Object.defineProperty){function gs(e){switch(e.nodeType){case si:case pi:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(gs(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(Si.prototype,"length",{get:function(){return Ei(this),this.$$length}}),Object.defineProperty(Ai.prototype,"textContent",{get:function(){return gs(this)},set:function(e){switch(this.nodeType){case si:case pi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ms=function(e,t,i){e["$$"+t]=i}}}catch(Gf){}Ft.DocumentType=ts,Ft.DOMException=vi,Ft.DOMImplementation=Ii,Ft.Element=Ki,Ft.Node=Ai,Ft.NodeList=Ti,Ft.XMLSerializer=os;var fs={},ys={};!function(e){var t=jt.freeze;e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES}(ys);var _s={},bs=jt.NAMESPACE,vs=/[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]/,Ts=new RegExp("[\\-\\.0-9"+vs.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ss=new RegExp("^"+vs.source+Ts.source+"*(?::"+vs.source+Ts.source+"*)?$"),Es=0,ws=1,ks=2,Cs=3,xs=4,Is=5,As=6,Ds=7;function Ls(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ls)}function Ps(){}function Os(e,t,i,s,r){function n(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?n(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function o(t){if(t>g){var i=e.substring(g,t).replace(/&#?\w+;/g,a);c&&l(g),s.characters(i,0,t-g),g=t}}function l(t,i){for(;t>=d&&(i=h.exec(e));)u=i.index,d=u+i[0].length,c.lineNumber++;c.columnNumber=t-u+1}for(var u=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,c=s.locator,p=[{currentNSMap:t}],m={},g=0;;){try{var f=e.indexOf("<",g);if(f<0){if(!e.substr(g).match(/^\s*$/)){var y=s.doc,_=y.createTextNode(e.substr(g));y.appendChild(_),s.currentElement=_}return}switch(f>g&&o(f),e.charAt(f+1)){case"/":var b=e.indexOf(">",f+3),v=e.substring(f+2,b).replace(/[ \t\n\r]+$/g,""),T=p.pop();b<0?(v=e.substring(f+2).replace(/[\s<].*/,""),r.error("end tag name: "+v+" is not complete:"+T.tagName),b=f+1+v.length):v.match(/\s</)&&(v=v.replace(/[\s<].*/,""),r.error("end tag name: "+v+" maybe not complete"),b=f+1+v.length);var S=T.localNSMap,E=T.tagName==v;if(E||T.tagName&&T.tagName.toLowerCase()==v.toLowerCase()){if(s.endElement(T.uri,T.localName,v),S)for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&s.endPrefixMapping(w);E||r.fatalError("end tag name: "+v+" is not match the current start tagName:"+T.tagName)}else p.push(T);b++;break;case"?":c&&l(f),b=qs(e,f,s);break;case"!":c&&l(f),b=js(e,f,s,r);break;default:c&&l(f);var k=new $s,C=p[p.length-1].currentNSMap,x=(b=Rs(e,f,k,C,a,r),k.length);if(!k.closed&&Bs(e,b,k.tagName,m)&&(k.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),c&&x){for(var I=Ns(c,{}),A=0;A<x;A++){var D=k[A];l(D.offset),D.locator=Ns(c,{})}s.locator=I,Ms(k,s,C)&&p.push(k),s.locator=c}else Ms(k,s,C)&&p.push(k);bs.isHTML(k.uri)&&!k.closed?b=Us(e,b,k.tagName,a,s):b++}}catch(Gf){if(Gf instanceof Ls)throw Gf;r.error("element parse error: "+Gf),b=-1}b>g?g=b:o(Math.max(f,g)+1)}}function Ns(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Rs(e,t,i,s,r,n){function a(e,t,s){i.attributeNames.hasOwnProperty(e)&&n.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),s)}for(var o,l=++t,u=Es;;){var d=e.charAt(l);switch(d){case"=":if(u===ws)o=e.slice(t,l),u=Cs;else{if(u!==ks)throw new Error("attribute equal must after attrName");u=Cs}break;case"'":case'"':if(u===Cs||u===ws){if(u===ws&&(n.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");a(o,h=e.slice(t,l),t-1),u=Is}else{if(u!=xs)throw new Error('attribute value must after "="');a(o,h=e.slice(t,l),t),n.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,u=Is}break;case"/":switch(u){case Es:i.setTagName(e.slice(t,l));case Is:case As:case Ds:u=Ds,i.closed=!0;case xs:case ws:break;case ks:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),u==Es&&i.setTagName(e.slice(t,l)),l;case">":switch(u){case Es:i.setTagName(e.slice(t,l));case Is:case As:case Ds:break;case xs:case ws:"/"===(h=e.slice(t,l)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case ks:u===ks&&(h=o),u==xs?(n.warning('attribute "'+h+'" missed quot(")!'),a(o,h,t)):(bs.isHTML(s[""])&&h.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),a(h,h,t));break;case Cs:throw new Error("attribute value missed!!")}return l;case"":d=" ";default:if(d<=" ")switch(u){case Es:i.setTagName(e.slice(t,l)),u=As;break;case ws:o=e.slice(t,l),u=ks;break;case xs:var h=e.slice(t,l);n.warning('attribute "'+h+'" missed quot(")!!'),a(o,h,t);case Is:u=As}else switch(u){case ks:i.tagName,bs.isHTML(s[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,u=ws;break;case Is:n.warning('attribute space is required"'+o+'"!!');case As:u=ws,t=l;break;case Cs:u=xs,t=l;break;case Ds:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Ms(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value;if((c=o.indexOf(":"))>0)var u=a.prefix=o.slice(0,c),d=o.slice(c+1),h="xmlns"===u&&d;else d=o,u=null,h="xmlns"===o&&"";a.localName=d,!1!==h&&(null==r&&(r={},Fs(i,i={})),i[h]=r[h]=l,a.uri=bs.XMLNS,t.startPrefixMapping(h,l))}for(n=e.length;n--;){(u=(a=e[n]).prefix)&&("xml"===u&&(a.uri=bs.XML),"xmlns"!==u&&(a.uri=i[u||""]))}var c;(c=s.indexOf(":"))>0?(u=e.prefix=s.slice(0,c),d=e.localName=s.slice(c+1)):(u=null,d=e.localName=s);var p=e.uri=i[u||""];if(t.startElement(p,d,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,d,s),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&t.endPrefixMapping(u)}function Us(e,t,i,s,r){if(/^(?:script|textarea)$/i.test(i)){var n=e.indexOf("</"+i+">",t),a=e.substring(t+1,n);if(/[&<]/.test(a))return/^script$/i.test(i)?(r.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,s),r.characters(a,0,a.length),n)}return t+1}function Bs(e,t,i,s){var r=s[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),s[i]=r),r<t}function Fs(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function js(e,t,i,s){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(s.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var n=Vs(e,t),a=n.length;if(a>1&&/!doctype/i.test(n[0][0])){var o=n[1][0],l=!1,u=!1;a>3&&(/^public$/i.test(n[2][0])?(l=n[3][0],u=a>4&&n[4][0]):/^system$/i.test(n[2][0])&&(u=n[3][0]));var d=n[a-1];return i.startDTD(o,l,u),i.endDTD(),d.index+d[0].length}return-1}function qs(e,t,i){var s=e.indexOf("?>",t);if(s){var r=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),s+2):-1}return-1}function $s(){this.attributeNames={}}function Vs(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(s.push(i),i[1])return s}Ls.prototype=new Error,Ls.prototype.name=Ls.name,Ps.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Fs(t,t={}),Os(e,t,i,s,this.errorHandler),s.endDocument()}},$s.prototype={setTagName:function(e){if(!Ss.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ss.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},_s.XMLReader=Ps,_s.ParseError=Ls;var Hs=jt,Ws=ys,Gs=_s,zs=Ft.DOMImplementation,Xs=Hs.NAMESPACE,Ks=Gs.ParseError,Ys=Gs.XMLReader;function Qs(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Js(e){this.options=e||{locator:{}}}function Zs(e,t,i){if(!e){if(t instanceof er)return t;e=t}var s={},r=e instanceof Function;function n(t){var n=e[t];!n&&r&&(n=2==e.length?function(i){e(t,i)}:e),s[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+ir(i))}||function(){}}return i=i||{},n("warning"),n("error"),n("fatalError"),s}function er(){this.cdata=!1}function tr(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function ir(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function sr(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function rr(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Js.prototype.parseFromString=function(e,t){var i=this.options,s=new Ys,r=i.domBuilder||new er,n=i.errorHandler,a=i.locator,o=i.xmlns||{},l=/\/x?html?$/.test(t),u=l?Ws.HTML_ENTITIES:Ws.XML_ENTITIES;a&&r.setDocumentLocator(a),s.errorHandler=Zs(n,r,a),s.domBuilder=i.domBuilder||r,l&&(o[""]=Xs.HTML),o.xml=o.xml||Xs.XML;var d=i.normalizeLineEndings||Qs;return e&&"string"==typeof e?s.parse(d(e),o,u):s.errorHandler.error("invalid doc source"),r.doc},er.prototype={startDocument:function(){this.doc=(new zs).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;rr(this,n),this.currentElement=n,this.locator&&tr(this.locator,n);for(var o=0;o<a;o++){e=s.getURI(o);var l=s.getValue(o),u=(i=s.getQName(o),r.createAttributeNS(e,i));this.locator&&tr(s.getLocator(o),u),u.value=u.nodeValue=l,n.setAttributeNode(u)}},endElement:function(e,t,i){var s=this.currentElement;s.tagName,this.currentElement=s.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&tr(this.locator,i),rr(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=sr.apply(this,arguments)){if(this.cdata)var s=this.doc.createCDATASection(e);else s=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(e)&&this.doc.appendChild(s),this.locator&&tr(this.locator,s)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=sr.apply(this,arguments);var s=this.doc.createComment(e);this.locator&&tr(this.locator,s),rr(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var s=this.doc.implementation;if(s&&s.createDocumentType){var r=s.createDocumentType(e,t,i);this.locator&&tr(this.locator,r),rr(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,ir(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,ir(this.locator))},fatalError:function(e){throw new Ks(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){er.prototype[e]=function(){return null}})),fs.__DOMHandler=er,fs.normalizeLineEndings=Qs,fs.DOMParser=Js;var nr=fs.DOMParser;const ar=e=>!!e&&"object"==typeof e,or=(...e)=>e.reduce(((e,t)=>("object"!=typeof t||Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ar(e[i])&&ar(t[i])?e[i]=or(e[i],t[i]):e[i]=t[i]})),e)),{}),lr=e=>Object.keys(e).map((t=>e[t])),ur=(e,t)=>{const i=[];for(let s=e;s<t;s++)i.push(s);return i},dr=e=>e.reduce(((e,t)=>e.concat(t)),[]),hr=e=>{if(!e.length)return[];const t=[];for(let i=0;i<e.length;i++)t.push(e[i]);return t},cr=(e,t)=>e.reduce(((e,i,s)=>(i[t]&&e.push(s),e)),[]),pr=(e,t)=>lr(e.reduce(((e,i)=>(i.forEach((i=>{e[t(i)]=i})),e)),{}));var mr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const gr=({baseUrl:e="",source:t="",range:i="",indexRange:s=""})=>{const r={uri:t,resolvedUri:Rt(e||"",t)};if(i||s){const e=(i||s).split("-");let t,n=g.BigInt?g.BigInt(e[0]):parseInt(e[0],10),a=g.BigInt?g.BigInt(e[1]):parseInt(e[1],10);n<Number.MAX_SAFE_INTEGER&&"bigint"==typeof n&&(n=Number(n)),a<Number.MAX_SAFE_INTEGER&&"bigint"==typeof a&&(a=Number(a)),t="bigint"==typeof a||"bigint"==typeof n?g.BigInt(a)-g.BigInt(n)+g.BigInt(1):a-n+1,"bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),r.byterange={length:t,offset:n}}return r},fr=e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?g.BigInt(e.offset)+g.BigInt(e.length)-g.BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`},yr=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),_r={static(e){const{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,n=yr(e.endNumber),a=t/i;return"number"==typeof n?{start:0,end:n}:"number"==typeof r?{start:0,end:r/a}:{start:0,end:s/a}},dynamic(e){const{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,u=yr(e.endNumber),d=(t+i)/1e3,h=s+a,c=d+o-h,p=Math.ceil(c*r/n),m=Math.floor((d-h-l)*r/n),g=Math.floor((d-h)*r/n);return{start:Math.max(0,m),end:"number"==typeof u?u:Math.min(p,g)}}},br=e=>t=>{const{duration:i,timescale:s=1,periodStart:r,startNumber:n=1}=e;return{number:n+t,duration:i/s,timeline:r,time:t*i}},vr=e=>{const{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=_r[t](e),l=ur(a,o).map(br(e));if("static"===t){const e=l.length-1,t="number"==typeof r?r:n;l[e].duration=t-i/s*e}return l},Tr=e=>{const{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(!t)throw new Error(mr.NO_BASE_URL);const u=gr({baseUrl:t,source:i.sourceURL,range:i.range}),d=gr({baseUrl:t,source:t,indexRange:r});if(d.map=u,l){const t=vr(e);t.length&&(d.duration=t[0].duration,d.timeline=t[0].timeline)}else s&&(d.duration=s,d.timeline=n);return d.presentationTime=a||n,d.number=o,[d]},Sr=(e,t,i)=>{const s=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,n=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,l=t.timescale,u=t.references.filter((e=>1!==e.referenceType)),d=[],h=e.endList?"static":"dynamic",c=e.sidx.timeline;let p,m=c,f=e.mediaSequence||0;p="bigint"==typeof t.firstOffset?g.BigInt(o)+t.firstOffset:o+t.firstOffset;for(let y=0;y<u.length;y++){const e=t.references[y],a=e.referencedSize,o=e.subsegmentDuration;let u;u="bigint"==typeof p?p+g.BigInt(a)-g.BigInt(1):p+a-1;const _=Tr({baseUrl:i,timescale:l,timeline:n,periodStart:c,presentationTime:m,number:f,duration:o,sourceDuration:r,indexRange:`${p}-${u}`,type:h})[0];s&&(_.map=s),d.push(_),p+="bigint"==typeof p?g.BigInt(a):a,m+=o/l,f++}return e.segments=d,e},Er=["AUDIO","SUBTITLES"],wr=1/60,kr=e=>pr(e,(({timeline:e})=>e)).sort(((e,t)=>e.timeline>t.timeline?1:-1)),Cr=(e,t)=>{for(let i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null},xr=e=>{let t=[];return Mt(e,Er,((e,i,s,r)=>{t=t.concat(e.playlists||[])})),t},Ir=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},Ar=({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));const s=Cr(e,t.attributes.NAME);if(!s)return;if(t.sidx)return;const r=t.segments[0],n=s.segments.findIndex((function(e){return Math.abs(e.presentationTime-r.presentationTime)<wr}));if(-1===n)return Ir({playlist:t,mediaSequence:s.mediaSequence+s.segments.length}),t.segments[0].discontinuity=!0,t.discontinuityStarts.unshift(0),void((!s.segments.length&&t.timeline>s.timeline||s.segments.length&&t.timeline>s.segments[s.segments.length-1].timeline)&&t.discontinuitySequence--);s.segments[n].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),Ir({playlist:t,mediaSequence:s.segments[n].number})}))},Dr=({oldManifest:e,newManifest:t})=>{const i=e.playlists.concat(xr(e)),s=t.playlists.concat(xr(t));return t.timelineStarts=kr([e.timelineStarts,t.timelineStarts]),Ar({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t},Lr=e=>e&&e.uri+"-"+fr(e.byterange),Pr=e=>lr(e.reduce(((e,t)=>{const i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((e=>(e.discontinuityStarts=cr(e.segments||[],"discontinuity"),e))),Or=(e,t)=>{const i=Lr(e.sidx),s=i&&t[i]&&t[i].sidx;return s&&Sr(e,s,e.sidx.resolvedUri),e},Nr=(e,t={})=>{if(!Object.keys(t).length)return e;for(const i in e)e[i]=Or(e[i],t);return e},Rr=({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{const o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},Mr=({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);const n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};return e.codecs&&(n.CODECS=e.codecs),{attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t}},Ur=(e,t={},i=!1)=>{let s;const r=e.reduce(((e,r)=>{const n=r.attributes.role&&r.attributes.role.value||"",a=r.attributes.lang||"";let o=r.attributes.label||"main";if(a&&!r.attributes.label){const e=n?` (${n})`:"";o=`${r.attributes.lang}${e}`}e[o]||(e[o]={language:a,autoselect:!0,default:"main"===n,playlists:[],uri:""});const l=Or(Rr(r,i),t);return e[o].playlists.push(l),void 0===s&&"main"===n&&(s=r,s.default=!0),e}),{});if(!s){r[Object.keys(r)[0]].default=!0}return r},Br=(e,t={})=>e.reduce(((e,i)=>{const s=i.attributes.label||i.attributes.lang||"text";return e[s]||(e[s]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),e[s].playlists.push(Or(Mr(i),t)),e}),{}),Fr=e=>e.reduce(((e,t)=>t?(t.forEach((t=>{const{channel:i,language:s}=t;e[s]={autoselect:!1,default:!1,instreamId:i,language:s},t.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[s].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[s]["3D"]=t["3D"])})),e):e),{}),jr=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{const r={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(r.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(r.contentProtection=e.contentProtection),i&&(r.sidx=i),r},qr=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,$r=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Vr=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,Hr=(e,t)=>{e.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=t.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))}))},Wr=e=>e?Object.keys(e).reduce(((t,i)=>{const s=e[i];return t.concat(s.playlists)}),[]):[],Gr=({dashPlaylists:e,locations:t,sidxMapping:i={},previousManifest:s,eventStream:r})=>{if(!e.length)return{};const{sourceDuration:n,type:a,suggestedPresentationDelay:o,minimumUpdatePeriod:l}=e[0].attributes,u=Pr(e.filter(qr)).map(jr),d=Pr(e.filter($r)),h=Pr(e.filter(Vr)),c=e.map((e=>e.attributes.captionServices)).filter(Boolean),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:n,playlists:Nr(u,i)};l>=0&&(p.minimumUpdatePeriod=1e3*l),t&&(p.locations=t),"dynamic"===a&&(p.suggestedPresentationDelay=o),r&&r.length>0&&(p.eventStream=r);const m=0===p.playlists.length,g=d.length?Ur(d,i,m):null,f=h.length?Br(h,i):null,y=u.concat(Wr(g),Wr(f)),_=y.map((({timelineStarts:e})=>e));return p.timelineStarts=kr(_),Hr(y,p.timelineStarts),g&&(p.mediaGroups.AUDIO.audio=g),f&&(p.mediaGroups.SUBTITLES.subs=f),c.length&&(p.mediaGroups["CLOSED-CAPTIONS"].cc=Fr(c)),s?Dr({oldManifest:s,newManifest:p}):p},zr=(e,t,i)=>{const{NOW:s,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=e,u=(s+r)/1e3+l-(n+o);return Math.ceil((u*a-t)/i)},Xr=(e,t)=>{const{type:i,minimumUpdatePeriod:s=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=e,u=[];let d=-1;for(let h=0;h<t.length;h++){const c=t[h],p=c.d,m=c.r||0,g=c.t||0;let f;if(d<0&&(d=g),g&&g>d&&(d=g),m<0){const o=h+1;f=o===t.length?"dynamic"===i&&s>0&&r.indexOf("$Number$")>0?zr(e,d,p):(n*a-d)/p:(t[o].t-d)/p}else f=m+1;const y=o+u.length+f;let _=o+u.length;for(;_<y;)u.push({number:_,duration:p/a,time:d,timeline:l}),d+=p,_++}return u},Kr=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Yr=e=>(t,i,s,r)=>{if("$$"===t)return"$";if(void 0===e[i])return t;const n=""+e[i];return"RepresentationID"===i?n:(r=s?parseInt(r,10):1,n.length>=r?n:`${new Array(r-n.length+1).join("0")}${n}`)},Qr=(e,t)=>e.replace(Kr,Yr(t)),Jr=(e,t)=>e.duration||t?e.duration?vr(e):Xr(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}],Zr=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,r=gr({baseUrl:e.baseUrl,source:Qr(s.sourceURL,i),range:s.range});return Jr(e,t).map((t=>{i.Number=t.number,i.Time=t.time;const s=Qr(e.media||"",i),n=e.timescale||1,a=e.presentationTimeOffset||0,o=e.periodStart+(t.time-a)/n;return{uri:s,timeline:t.timeline,duration:t.duration,resolvedUri:Rt(e.baseUrl||"",s),map:r,number:t.number,presentationTime:o}}))},en=(e,t)=>{const{baseUrl:i,initialization:s={}}=e,r=gr({baseUrl:i,source:s.sourceURL,range:s.range}),n=gr({baseUrl:i,source:t.media,range:t.mediaRange});return n.map=r,n},tn=(e,t)=>{const{duration:i,segmentUrls:s=[],periodStart:r}=e;if(!i&&!t||i&&t)throw new Error(mr.SEGMENT_TIME_UNSPECIFIED);const n=s.map((t=>en(e,t)));let a;i&&(a=vr(e)),t&&(a=Xr(e,t));return a.map(((t,i)=>{if(n[i]){const s=n[i],a=e.timescale||1,o=e.presentationTimeOffset||0;return s.timeline=t.timeline,s.duration=t.duration,s.number=t.number,s.presentationTime=r+(t.time-o)/a,s}})).filter((e=>e))},sn=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Zr,i=or(e,t.template)):t.base?(s=Tr,i=or(e,t.base)):t.list&&(s=tn,i=or(e,t.list));const r={attributes:e};if(!s)return r;const n=s(i,t.segmentTimeline);if(i.duration){const{duration:e,timescale:t=1}=i;i.duration=e/t}else n.length?i.duration=n.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0;return r.attributes=i,r.segments=n,t.base&&i.indexRange&&(r.sidx=n[0],r.segments=[]),r},rn=e=>e.map(sn),nn=(e,t)=>hr(e.childNodes).filter((({tagName:e})=>e===t)),an=e=>e.textContent.trim(),on=e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))),ln=e=>{const t=31536e3,i=2592e3,s=86400,r=3600,n=60,a=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!a)return 0;const[o,l,u,d,h,c]=a.slice(1);return parseFloat(o||0)*t+parseFloat(l||0)*i+parseFloat(u||0)*s+parseFloat(d||0)*r+parseFloat(h||0)*n+parseFloat(c||0)},un=e=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)),dn={mediaPresentationDuration:e=>ln(e),availabilityStartTime:e=>un(e)/1e3,minimumUpdatePeriod:e=>ln(e),suggestedPresentationDelay:e=>ln(e),type:e=>e,timeShiftBufferDepth:e=>ln(e),start:e=>ln(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>on(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){const t=parseInt(e,10);return isNaN(t)?ln(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},hn=e=>e&&e.attributes?hr(e.attributes).reduce(((e,t)=>{const i=dn[t.name]||dn.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},cn={"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"},pn=(e,t)=>t.length?dr(e.map((function(e){return t.map((function(t){return Rt(e,an(t))}))}))):e,mn=e=>{const t=nn(e,"SegmentTemplate")[0],i=nn(e,"SegmentList")[0],s=i&&nn(i,"SegmentURL").map((e=>or({tag:"SegmentURL"},hn(e)))),r=nn(e,"SegmentBase")[0],n=i||t,a=n&&nn(n,"SegmentTimeline")[0],o=i||r||t,l=o&&nn(o,"Initialization")[0],u=t&&hn(t);u&&l?u.initialization=l&&hn(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});const d={template:u,segmentTimeline:a&&nn(a,"S").map((e=>hn(e))),list:i&&or(hn(i),{segmentUrls:s,initialization:hn(l)}),base:r&&or(hn(r),{initialization:hn(l)})};return Object.keys(d).forEach((e=>{d[e]||delete d[e]})),d},gn=(e,t,i)=>s=>{const r=nn(s,"BaseURL"),n=pn(t,r),a=or(e,hn(s)),o=mn(s);return n.map((e=>({segmentInfo:or(i,o),attributes:or(a,{baseUrl:e})})))},fn=e=>e.reduce(((e,t)=>{const i=hn(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const s=cn[i.schemeIdUri];if(s){e[s]={attributes:i};const r=nn(t,"cenc:pssh")[0];if(r){const t=an(r);e[s].pssh=t&&Bt(t)}}return e}),{}),yn=e=>{if("urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri){return("string"!=typeof e.value?[]:e.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}))}if("urn:scte:dash:cc:cea-708:2015"===e.schemeIdUri){return("string"!=typeof e.value?[]:e.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[i,s=""]=e.split("=");t.channel=i,t.language=e,s.split(",").forEach((e=>{const[i,s]=e.split(":");"lang"===i?t.language=s:"er"===i?t.easyReader=Number(s):"war"===i?t.aspectRatio=Number(s):"3D"===i&&(t["3D"]=Number(s))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}))}},_n=e=>dr(nn(e.node,"EventStream").map((t=>{const i=hn(t),s=i.schemeIdUri;return nn(t,"Event").map((t=>{const r=hn(t),n=r.presentationTime||0,a=i.timescale||1,o=r.duration||0,l=n/a+e.attributes.start;return{schemeIdUri:s,value:i.value,id:r.id,start:l,end:l+o/a,messageData:an(t)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),bn=(e,t,i)=>s=>{const r=hn(s),n=pn(t,nn(s,"BaseURL")),a=nn(s,"Role")[0],o={role:hn(a)};let l=or(e,r,o);const u=nn(s,"Accessibility")[0],d=yn(hn(u));d&&(l=or(l,{captionServices:d}));const h=nn(s,"Label")[0];if(h&&h.childNodes.length){const e=h.childNodes[0].nodeValue.trim();l=or(l,{label:e})}const c=fn(nn(s,"ContentProtection"));Object.keys(c).length&&(l=or(l,{contentProtection:c}));const p=mn(s),m=nn(s,"Representation"),g=or(i,p);return dr(m.map(gn(l,n,g)))},vn=(e,t)=>(i,s)=>{const r=pn(t,nn(i.node,"BaseURL")),n=or(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(n.periodDuration=i.attributes.duration);const a=nn(i.node,"AdaptationSet"),o=mn(i.node);return dr(a.map(bn(n,r,o)))},Tn=({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0,Sn=(e,t={})=>{const{manifestUri:i="",NOW:s=Date.now(),clientOffset:r=0}=t,n=nn(e,"Period");if(!n.length)throw new Error(mr.INVALID_NUMBER_OF_PERIOD);const a=nn(e,"Location"),o=hn(e),l=pn([i],nn(e,"BaseURL"));o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=s,o.clientOffset=r,a.length&&(o.locations=a.map(an));const u=[];return n.forEach(((e,t)=>{const i=hn(e),s=u[t-1];i.start=Tn({attributes:i,priorPeriodAttributes:s?s.attributes:null,mpdType:o.type}),u.push({node:e,attributes:i})})),{locations:o.locations,representationInfo:dr(u.map(vn(o,l))),eventStream:dr(u.map(_n))}},En=e=>{if(""===e)throw new Error(mr.DASH_EMPTY_MANIFEST);const t=new nr;let i,s;try{i=t.parseFromString(e,"application/xml"),s=i&&"MPD"===i.documentElement.tagName?i.documentElement:null}catch(Gf){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error(mr.DASH_INVALID_XML);return s},wn=e=>{const t=nn(e,"UTCTiming")[0];if(!t)return null;const i=hn(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error(mr.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},kn=(e,t={})=>{const i=Sn(En(e),t),s=rn(i.representationInfo);return Gr({dashPlaylists:s,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})},Cn=e=>wn(En(e));var xn=Math.pow(2,32),In={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*xn+i.getUint32(4)},MAX_UINT32:xn}.getUint64;const An=h((function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},s=12;0===i.version?(i.earliestPresentationTime=t.getUint32(s),i.firstOffset=t.getUint32(s+4),s+=8):(i.earliestPresentationTime=In(e.subarray(s)),i.firstOffset=In(e.subarray(s+8)),s+=16),s+=2;var r=t.getUint16(s);for(s+=2;r>0;s+=12,r--)i.references.push({referenceType:(128&e[s])>>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i}));var Dn=Ct([73,68,51]),Ln=function(e,t){void 0===t&&(t=0);var i=(e=Ct(e))[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?s+20:s+10},Pn=function e(t,i){return void 0===i&&(i=0),(t=Ct(t)).length-i<10||!Ot(t,Dn,{offset:i})?i:e(t,i+=Ln(t,i))},On=function(e){return"string"==typeof e?Lt(e):e},Nn=function(e){return Array.isArray(e)?e.map((function(e){return On(e)})):[On(e)]},Rn=function e(t,i,s){void 0===s&&(s=!1),i=Nn(i),t=Ct(t);var r=[];if(!i.length)return r;for(var n=0;n<t.length;){var a=(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0,o=t.subarray(n+4,n+8);if(0===a)break;var l=n+a;if(l>t.length){if(s)break;l=t.length}var u=t.subarray(n+8,l);Ot(o,i[0])&&(1===i.length?r.push(u):r.push.apply(r,e(u,i.slice(1),s))),n=l}return r},Mn={EBML:Ct([26,69,223,163]),DocType:Ct([66,130]),Segment:Ct([24,83,128,103]),SegmentInfo:Ct([21,73,169,102]),Tracks:Ct([22,84,174,107]),Track:Ct([174]),TrackNumber:Ct([215]),DefaultDuration:Ct([35,227,131]),TrackEntry:Ct([174]),TrackType:Ct([131]),FlagDefault:Ct([136]),CodecID:Ct([134]),CodecPrivate:Ct([99,162]),VideoTrack:Ct([224]),AudioTrack:Ct([225]),Cluster:Ct([31,67,182,117]),Timestamp:Ct([231]),TimestampScale:Ct([42,215,177]),BlockGroup:Ct([160]),BlockDuration:Ct([155]),Block:Ct([161]),SimpleBlock:Ct([163])},Un=[128,64,32,16,8,4,2,1],Bn=function(e){for(var t=1,i=0;i<Un.length&&!(e&Un[i]);i++)t++;return t},Fn=function(e,t,i,s){void 0===i&&(i=!0),void 0===s&&(s=!1);var r=Bn(e[t]),n=e.subarray(t,t+r);return i&&((n=Array.prototype.slice.call(e,t,t+r))[0]^=Un[r-1]),{length:r,value:At(n,{signed:s}),bytes:n}},jn=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map((function(t){return e(t)})):"number"==typeof t?Dt(t):t},qn=function(e){return Array.isArray(e)?e.map((function(e){return jn(e)})):[jn(e)]},$n=function e(t,i,s){if(s>=i.length)return i.length;var r=Fn(i,s,!1);if(Ot(t.bytes,r.bytes))return s;var n=Fn(i,s+r.length);return e(t,i,s+n.length+n.value+r.length)},Vn=function e(t,i){i=qn(i),t=Ct(t);var s=[];if(!i.length)return s;for(var r=0;r<t.length;){var n=Fn(t,r,!1),a=Fn(t,r+n.length),o=r+n.length+a.length;127===a.value&&(a.value=$n(n,t,o),a.value!==t.length&&(a.value-=o));var l=o+a.value>t.length?t.length:o+a.value,u=t.subarray(o,l);Ot(i[0],n.bytes)&&(1===i.length?s.push(u):s=s.concat(e(u,i.slice(1)))),r+=n.length+a.length+u.length}return s},Hn=Ct([0,0,0,1]),Wn=Ct([0,0,1]),Gn=Ct([0,0,3]),zn=function(e){for(var t=[],i=1;i<e.length-2;)Ot(e.subarray(i,i+3),Gn)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var s=e.length-t.length,r=new Uint8Array(s),n=0;for(i=0;i<s;n++,i++)n===t[0]&&(n++,t.shift()),r[i]=e[n];return r},Xn=function(e,t,i,s){void 0===s&&(s=1/0),e=Ct(e),i=[].concat(i);for(var r,n=0,a=0;n<e.length&&(a<s||r);){var o=void 0;if(Ot(e.subarray(n),Hn)?o=4:Ot(e.subarray(n),Wn)&&(o=3),o){if(a++,r)return zn(e.subarray(r,n));var l=void 0;"h264"===t?l=31&e[n+o]:"h265"===t&&(l=e[n+o]>>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)},Kn=function(e,t,i){return Xn(e,"h264",t,i)},Yn=function(e,t,i){return Xn(e,"h265",t,i)},Qn={webm:Ct([119,101,98,109]),matroska:Ct([109,97,116,114,111,115,107,97]),flac:Ct([102,76,97,67]),ogg:Ct([79,103,103,83]),ac3:Ct([11,119]),riff:Ct([82,73,70,70]),avi:Ct([65,86,73]),wav:Ct([87,65,86,69]),"3gp":Ct([102,116,121,112,51,103]),mp4:Ct([102,116,121,112]),fmp4:Ct([115,116,121,112]),mov:Ct([102,116,121,112,113,116]),moov:Ct([109,111,111,118]),moof:Ct([109,111,111,102])},Jn={aac:function(e){var t=Pn(e);return Ot(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Pn(e);return Ot(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Vn(e,[Mn.EBML,Mn.DocType])[0];return Ot(t,Qn.webm)},mkv:function(e){var t=Vn(e,[Mn.EBML,Mn.DocType])[0];return Ot(t,Qn.matroska)},mp4:function(e){return!Jn["3gp"](e)&&!Jn.mov(e)&&(!(!Ot(e,Qn.mp4,{offset:4})&&!Ot(e,Qn.fmp4,{offset:4}))||(!(!Ot(e,Qn.moof,{offset:4})&&!Ot(e,Qn.moov,{offset:4}))||void 0))},mov:function(e){return Ot(e,Qn.mov,{offset:4})},"3gp":function(e){return Ot(e,Qn["3gp"],{offset:4})},ac3:function(e){var t=Pn(e);return Ot(e,Qn.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=Pn(e);return Ot(e,Qn.flac,{offset:t})},ogg:function(e){return Ot(e,Qn.ogg)},avi:function(e){return Ot(e,Qn.riff)&&Ot(e,Qn.avi,{offset:8})},wav:function(e){return Ot(e,Qn.riff)&&Ot(e,Qn.wav,{offset:8})},h264:function(e){return Kn(e,7,3).length},h265:function(e){return Yn(e,[32,33],3).length}},Zn=Object.keys(Jn).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);Zn.forEach((function(e){var t=Jn[e];Jn[e]=function(e){return t(Ct(e))}}));var ea,ta,ia,sa,ra,na,aa,oa=Jn,la=function(e){e=Ct(e);for(var t=0;t<Zn.length;t++){var i=Zn[t];if(oa[i](e))return i}return""},ua=function(e){return Rn(e,["moof"]).length>0},da=9e4;ra=function(e,t){return ea(sa(e,t))},na=function(e,t){return ta(ia(e),t)},aa=function(e,t,i){return ia(i?e:e-t)};var ha={ONE_SECOND_IN_TS:da,secondsToVideoTs:ea=function(e){return e*da},secondsToAudioTs:ta=function(e,t){return e*t},videoTsToSeconds:ia=function(e){return e/da},audioTsToSeconds:sa=function(e,t){return e/t},audioTsToVideoTs:ra,videoTsToAudioTs:na,metadataTsToSeconds:aa},ca="8.3.0";const pa={},ma=function(e,t){return pa[e]=pa[e]||[],t&&(pa[e]=pa[e].concat(t)),pa[e]},ga=function(e,t){ma(e,t)},fa=function(e,t){const i=ma(e).indexOf(t);return!(i<=-1)&&(pa[e]=pa[e].slice(),pa[e].splice(i,1),!0)},ya=function(e,t){ma(e,[].concat(t).map((t=>{const i=(...s)=>(fa(e,i),t(...s));return i})))},_a={prefixed:!0},ba=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],va=ba[0];let Ta;for(let zf=0;zf<ba.length;zf++)if(ba[zf][1]in S){Ta=ba[zf];break}if(Ta){for(let Xf=0;Xf<Ta.length;Xf++)_a[va[Xf]]=Ta[Xf];_a.prefixed=Ta[0]!==va[0]}let Sa=[];const Ea=(e,t)=>(i,s,r)=>{const n=t.levels[s],a=new RegExp(`^(${n})$`);if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),Sa){Sa.push([].concat(r));const e=Sa.length-1e3;Sa.splice(0,e>0?e:0)}if(!g.console)return;let o=g.console[i];o||"debug"!==i||(o=g.console.info||g.console.log),o&&n&&a.test(i)&&o[Array.isArray(r)?"apply":"call"](g.console,r)};function wa(e){let t,i="info";const s=function(...e){t("log",i,e)};return t=Ea(e,s),s.createLogger=t=>wa(e+": "+t),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},s.level=e=>{if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);i=e}return i},s.history=()=>Sa?[].concat(Sa):[],s.history.filter=e=>(Sa||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),s.history.clear=()=>{Sa&&(Sa.length=0)},s.history.disable=()=>{null!==Sa&&(Sa.length=0,Sa=null)},s.history.enable=()=>{null===Sa&&(Sa=[])},s.error=(...e)=>t("error",i,e),s.warn=(...e)=>t("warn",i,e),s.debug=(...e)=>t("debug",i,e),s}const ka=wa("VIDEOJS"),Ca=ka.createLogger,xa=Object.prototype.toString,Ia=function(e){return La(e)?Object.keys(e):[]};function Aa(e,t){Ia(e).forEach((i=>t(e[i],i)))}function Da(e,t,i=0){return Ia(e).reduce(((i,s)=>t(i,e[s],s)),i)}function La(e){return!!e&&"object"==typeof e}function Pa(e){return La(e)&&"[object Object]"===xa.call(e)&&e.constructor===Object}function Oa(...e){const t={};return e.forEach((e=>{e&&Aa(e,((e,i)=>{Pa(e)?(Pa(t[i])||(t[i]={}),t[i]=Oa(t[i],e)):t[i]=e}))})),t}function Na(e,t,i,s=!0){const r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const e=i();return r(e),e}};return s&&(n.set=r),Object.defineProperty(e,t,n)}var Ra=Object.freeze({__proto__:null,each:Aa,reduce:Da,isObject:La,isPlain:Pa,merge:Oa,defineLazyProperty:Na});let Ma,Ua=!1,Ba=null,Fa=!1,ja=!1,qa=!1,$a=!1,Va=!1,Ha=null,Wa=null,Ga=null,za=!1,Xa=!1,Ka=!1,Ya=!1;const Qa=Boolean(ro()&&("ontouchstart"in g||g.navigator.maxTouchPoints||g.DocumentTouch&&g.document instanceof g.DocumentTouch)),Ja=g.navigator&&g.navigator.userAgentData;if(Ja&&(Fa="Android"===Ja.platform,qa=Boolean(Ja.brands.find((e=>"Microsoft Edge"===e.brand))),$a=Boolean(Ja.brands.find((e=>"Chromium"===e.brand))),Va=!qa&&$a,Ha=Wa=(Ja.brands.find((e=>"Chromium"===e.brand))||{}).version||null,Xa="Windows"===Ja.platform),!$a){const Kf=g.navigator&&g.navigator.userAgent||"";Ua=/iPod/i.test(Kf),Ba=function(){const e=Kf.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Fa=/Android/i.test(Kf),Ma=function(){const e=Kf.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),ja=/Firefox/i.test(Kf),qa=/Edg/i.test(Kf),$a=/Chrome/i.test(Kf)||/CriOS/i.test(Kf),Va=!qa&&$a,Ha=Wa=function(){const e=Kf.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ga=function(){const e=/MSIE\s(\d+)\.\d/.exec(Kf);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Kf)&&/rv:11.0/.test(Kf)&&(t=11),t}(),za=/Safari/i.test(Kf)&&!Va&&!Fa&&!qa,Xa=/Windows/i.test(Kf),Ka=/iPad/i.test(Kf)||za&&Qa&&!/iPhone/i.test(Kf),Ya=/iPhone/i.test(Kf)&&!Ka}const Za=Ya||Ka||Ua,eo=(za||Za)&&!Va;var to=Object.freeze({__proto__:null,get IS_IPOD(){return Ua},get IOS_VERSION(){return Ba},get IS_ANDROID(){return Fa},get ANDROID_VERSION(){return Ma},get IS_FIREFOX(){return ja},get IS_EDGE(){return qa},get IS_CHROMIUM(){return $a},get IS_CHROME(){return Va},get CHROMIUM_VERSION(){return Ha},get CHROME_VERSION(){return Wa},get IE_VERSION(){return Ga},get IS_SAFARI(){return za},get IS_WINDOWS(){return Xa},get IS_IPAD(){return Ka},get IS_IPHONE(){return Ya},TOUCH_ENABLED:Qa,IS_IOS:Za,IS_ANY_SAFARI:eo});function io(e){return"string"==typeof e&&Boolean(e.trim())}function so(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ro(){return S===g.document}function no(e){return La(e)&&1===e.nodeType}function ao(){try{return g.parent!==g.self}catch(e){return!0}}function oo(e){return function(t,i){if(!io(t))return S[e](null);io(i)&&(i=S.querySelector(i));const s=no(i)?i:S;return s[e]&&s[e](t)}}function lo(e="div",t={},i={},s){const r=S.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){const i=t[e];"textContent"===e?uo(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),s&&Ao(r,s),r}function uo(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function ho(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function co(e,t){return so(t),e.classList.contains(t)}function po(e,...t){return e.classList.add(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e}function mo(e,...t){return e?(e.classList.remove(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e):(ka.warn("removeClass was called with an element that doesn't exist"),null)}function go(e,t,i){return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=void 0),t.split(/\s+/).forEach((t=>e.classList.toggle(t,i))),e}function fo(e,t){Object.getOwnPropertyNames(t).forEach((function(i){const s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)}))}function yo(e){const t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0){const s=e.attributes;for(let r=s.length-1;r>=0;r--){const n=s[r].name;let a=s[r].value;"boolean"!=typeof e[n]&&-1===i.indexOf(","+n+",")||(a=null!==a),t[n]=a}}return t}function _o(e,t){return e.getAttribute(t)}function bo(e,t,i){e.setAttribute(t,i)}function vo(e,t){e.removeAttribute(t)}function To(){S.body.focus(),S.onselectstart=function(){return!1}}function So(){S.onselectstart=function(){return!0}}function Eo(e){if(e&&e.getBoundingClientRect&&e.parentNode){const t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(No(e,"height"))),i.width||(i.width=parseFloat(No(e,"width"))),i}}function wo(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};const t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==S[_a.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function ko(e,t){const i={x:0,y:0};if(Za){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){const e=No(t,"transform");if(/^matrix/.test(e)){const t=e.slice(7,-1).split(/,\s/).map(Number);i.x+=t[4],i.y+=t[5]}else if(/^matrix3d/.test(e)){const t=e.slice(9,-1).split(/,\s/).map(Number);i.x+=t[12],i.y+=t[13]}t=t.parentNode}}const s={},r=wo(t.target),n=wo(e),a=n.width,o=n.height;let l=t.offsetY-(n.top-r.top),u=t.offsetX-(n.left-r.left);return t.changedTouches&&(u=t.changedTouches[0].pageX-n.left,l=t.changedTouches[0].pageY+n.top,Za&&(u-=i.x,l-=i.y)),s.y=1-Math.max(0,Math.min(1,l/o)),s.x=Math.max(0,Math.min(1,u/a)),s}function Co(e){return La(e)&&3===e.nodeType}function xo(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Io(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((e=>("function"==typeof e&&(e=e()),no(e)||Co(e)?e:"string"==typeof e&&/\S/.test(e)?S.createTextNode(e):void 0))).filter((e=>e))}function Ao(e,t){return Io(t).forEach((t=>e.appendChild(t))),e}function Do(e,t){return Ao(xo(e),t)}function Lo(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}const Po=oo("querySelector"),Oo=oo("querySelectorAll");function No(e,t){if(!e||!t)return"";if("function"==typeof g.getComputedStyle){let i;try{i=g.getComputedStyle(e)}catch(Gf){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}var Ro=Object.freeze({__proto__:null,isReal:ro,isEl:no,isInFrame:ao,createEl:lo,textContent:uo,prependTo:ho,hasClass:co,addClass:po,removeClass:mo,toggleClass:go,setAttributes:fo,getAttributes:yo,getAttribute:_o,setAttribute:bo,removeAttribute:vo,blockTextSelection:To,unblockTextSelection:So,getBoundingClientRect:Eo,findPosition:wo,getPointerPosition:ko,isTextNode:Co,emptyEl:xo,normalizeContent:Io,appendContent:Ao,insertContent:Do,isSingleLeftClick:Lo,$:Po,$$:Oo,computedStyle:No});let Mo,Uo=!1;const Bo=function(){if(!1===Mo.options.autoSetup)return;const e=Array.prototype.slice.call(S.getElementsByTagName("video")),t=Array.prototype.slice.call(S.getElementsByTagName("audio")),i=Array.prototype.slice.call(S.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&s.length>0)for(let r=0,n=s.length;r<n;r++){const e=s[r];if(!e||!e.getAttribute){Fo(1);break}if(void 0===e.player){null!==e.getAttribute("data-setup")&&Mo(e)}}else Uo||Fo(1)};function Fo(e,t){ro()&&(t&&(Mo=t),g.setTimeout(Bo,e))}function jo(){Uo=!0,g.removeEventListener("load",jo)}ro()&&("complete"===S.readyState?jo():g.addEventListener("load",jo));const qo=function(e){const t=S.createElement("style");return t.className=e,t},$o=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t};var Vo=new WeakMap;let Ho,Wo=3;function Go(){return Wo++}function zo(e,t){if(!Vo.has(e))return;const i=Vo.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&Vo.delete(e)}function Xo(e,t,i,s){i.forEach((function(i){e(t,i,s)}))}function Ko(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){const s=e||g.event;e={};for(const t in s)"layerX"!==t&&"layerY"!==t&&"keyLocation"!==t&&"webkitMovementX"!==t&&"webkitMovementY"!==t&&"path"!==t&&("returnValue"===t&&s.preventDefault||(e[t]=s[t]));if(e.target||(e.target=e.srcElement||S),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){s.preventDefault&&s.preventDefault(),e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){const t=S.documentElement,i=S.body;e.pageX=e.clientX+(t&&t.scrollLeft||i&&i.scrollLeft||0)-(t&&t.clientLeft||i&&i.clientLeft||0),e.pageY=e.clientY+(t&&t.scrollTop||i&&i.scrollTop||0)-(t&&t.clientTop||i&&i.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}const Yo=function(){if("boolean"!=typeof Ho){Ho=!1;try{const e=Object.defineProperty({},"passive",{get(){Ho=!0}});g.addEventListener("test",null,e),g.removeEventListener("test",null,e)}catch(Gf){}}return Ho},Qo=["touchstart","touchmove"];function Jo(e,t,i){if(Array.isArray(t))return Xo(Jo,e,t,i);Vo.has(e)||Vo.set(e,{});const s=Vo.get(e);if(s.handlers||(s.handlers={}),s.handlers[t]||(s.handlers[t]=[]),i.guid||(i.guid=Go()),s.handlers[t].push(i),s.dispatcher||(s.disabled=!1,s.dispatcher=function(t,i){if(s.disabled)return;t=Ko(t);const r=s.handlers[t.type];if(r){const s=r.slice(0);for(let r=0,n=s.length;r<n&&!t.isImmediatePropagationStopped();r++)try{s[r].call(e,t,i)}catch(Gf){ka.error(Gf)}}}),1===s.handlers[t].length)if(e.addEventListener){let i=!1;Yo()&&Qo.indexOf(t)>-1&&(i={passive:!0}),e.addEventListener(t,s.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,s.dispatcher)}function Zo(e,t,i){if(!Vo.has(e))return;const s=Vo.get(e);if(!s.handlers)return;if(Array.isArray(t))return Xo(Zo,e,t,i);const r=function(e,t){s.handlers[t]=[],zo(e,t)};if(void 0===t){for(const t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&r(e,t);return}const n=s.handlers[t];if(n)if(i){if(i.guid)for(let e=0;e<n.length;e++)n[e].guid===i.guid&&n.splice(e--,1);zo(e,t)}else r(e,t)}function el(e,t,i){const s=Vo.has(e)?Vo.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Ko(t),s.dispatcher&&s.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)el.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){Vo.has(t.target)||Vo.set(t.target,{});const e=Vo.get(t.target);t.target[t.type]&&(e.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),e.disabled=!1)}return!t.defaultPrevented}function tl(e,t,i){if(Array.isArray(t))return Xo(tl,e,t,i);const s=function(){Zo(e,t,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Go(),Jo(e,t,s)}function il(e,t,i){const s=function(){Zo(e,t,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Go(),Jo(e,t,s)}var sl=Object.freeze({__proto__:null,fixEvent:Ko,on:Jo,off:Zo,trigger:el,one:tl,any:il});const rl=30,nl=function(e,t,i){t.guid||(t.guid=Go());const s=t.bind(e);return s.guid=i?i+"_"+t.guid:t.guid,s},al=function(e,t){let i=g.performance.now();return function(...s){const r=g.performance.now();r-i>=t&&(e(...s),i=r)}},ol=function(e,t,i,s=g){let r;const n=()=>{s.clearTimeout(r),r=null},a=function(){const n=this,a=arguments;let o=function(){r=null,o=null,i||e.apply(n,a)};!r&&i&&e.apply(n,a),s.clearTimeout(r),r=s.setTimeout(o,t)};return a.cancel=n,a};var ll=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:rl,bind_:nl,throttle:al,debounce:ol});let ul;class dl{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Jo(this,e,t),this.addEventListener=i}off(e,t){Zo(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},tl(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},il(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;"string"==typeof e&&(e={type:t}),e=Ko(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),el(this,e)}queueTrigger(e){ul||(ul=new Map);const t=e.type||e;let i=ul.get(this);i||(i=new Map,ul.set(this,i));const s=i.get(t);i.delete(t),g.clearTimeout(s);const r=g.setTimeout((()=>{i.delete(t),0===i.size&&(i=null,ul.delete(this)),this.trigger(e)}),0);i.set(t,r)}}dl.prototype.allowedEvents_={},dl.prototype.addEventListener=dl.prototype.on,dl.prototype.removeEventListener=dl.prototype.off,dl.prototype.dispatchEvent=dl.prototype.trigger;const hl=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e,cl=e=>e instanceof dl||!!e.eventBusEl_&&["on","one","off","trigger"].every((t=>"function"==typeof e[t])),pl=(e,t)=>{cl(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))},ml=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,gl=(e,t,i)=>{if(!e||!e.nodeName&&!cl(e))throw new Error(`Invalid target for ${hl(t)}#${i}; must be a DOM node or evented object.`)},fl=(e,t,i)=>{if(!ml(e))throw new Error(`Invalid event type for ${hl(t)}#${i}; must be a non-empty string or array.`)},yl=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${hl(t)}#${i}; must be a function.`)},_l=(e,t,i)=>{const s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,t.length>=3&&t.shift(),[n,a]=t):[r,n,a]=t,gl(r,e,i),fl(n,e,i),yl(a,e,i),a=nl(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},bl=(e,t,i,s)=>{gl(e,e,t),e.nodeName?sl[t](e,i,s):e[t](i,s)},vl={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"on");if(bl(i,"on",s,r),!t){const e=()=>this.off(i,s,r);e.guid=r.guid;const t=()=>this.off("dispose",e);t.guid=r.guid,bl(this,"on","dispose",e),bl(i,"on","dispose",t)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"one");if(t)bl(i,"one",s,r);else{const e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,bl(i,"one",s,e)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"any");if(t)bl(i,"any",s,r);else{const e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,bl(i,"any",s,e)}},off(e,t,i){if(!e||ml(e))Zo(this.eventBusEl_,e,t);else{const s=e,r=t;gl(s,this,"off"),fl(r,this,"off"),yl(i,this,"off"),i=nl(this,i),this.off("dispose",i),s.nodeName?(Zo(s,r,i),Zo(s,"dispose",i)):cl(s)&&(s.off(r,i),s.off("dispose",i))}},trigger(e,t){gl(this.eventBusEl_,this,"trigger");const i=e&&"string"!=typeof e?e.type:e;if(!ml(i))throw new Error(`Invalid event type for ${hl(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return el(this.eventBusEl_,e,t)}};function Tl(e,t={}){const{eventBusKey:i}=t;if(i){if(!e[i].nodeName)throw new Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=lo("span",{className:"vjs-event-bus"});return Object.assign(e,vl),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Vo.has(e)&&Vo.delete(e)})),g.setTimeout((()=>{e.eventBusEl_=null}),0)})),e}const Sl={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),Aa(e,((e,i)=>{this.state[i]!==e&&(t=t||{},t[i]={from:this.state[i],to:e}),this.state[i]=e})),t&&cl(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function El(e,t){return Object.assign(e,Sl),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&cl(e)&&e.on("statechanged",e.handleStateChanged),e}const wl=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))},kl=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Cl=function(e,t){return kl(e)===kl(t)};var xl=Object.freeze({__proto__:null,toLowerCase:wl,toTitleCase:kl,titleCaseEquals:Cl});class Il{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Oa({},this.options_),t=this.options_=Oa(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${Go()}`}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((e=>this.addClass(e))),["on","off","one","any","trigger"].forEach((e=>{this[e]=void 0})),!1!==t.evented&&(Tl(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),El(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=Oa(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return lo(e,t,i)}localize(e,t,i=e){const s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],a=s&&s.split("-")[0],o=r&&r[a];let l=i;return n&&n[e]?l=n[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){const s=t[i-1];let r=s;return void 0===s&&(r=e),r}))),l}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce(((e,t)=>e.concat(t)),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}addChild(e,t={},i=this.children_.length){let s,r;if("string"==typeof e){r=kl(e);const i=t.componentClass||r;t.name=r;const n=Il.getComponent(i);if(!n)throw new Error(`Component ${i} does not exist`);if("function"!=typeof n)return null;s=new n(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(i,0,s),s.parentComponent_=this,"function"==typeof s.id&&(this.childIndex_[s.id()]=s),r=r||s.name&&kl(s.name()),r&&(this.childNameIndex_[r]=s,this.childNameIndex_[wl(r)]=s),"function"==typeof s.el&&s.el()){let e=null;this.children_[i+1]&&(this.children_[i+1].el_?e=this.children_[i+1].el_:no(this.children_[i+1])&&(e=this.children_[i+1])),this.contentEl().insertBefore(s.el(),e)}return s}removeChild(e){if("string"==typeof e&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[kl(e.name())]=null,this.childNameIndex_[wl(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=e=>{const i=e.name;let s=e.opts;if(void 0!==t[i]&&(s=t[i]),!1===s)return;!0===s&&(s={}),s.playerOptions=this.options_.playerOptions;const r=this.addChild(i,s);r&&(this[i]=r)};let s;const r=Il.getComponent("Tech");s=Array.isArray(e)?e:Object.keys(e),s.concat(Object.keys(this.options_).filter((function(e){return!s.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((t=>{let i,s;return"string"==typeof t?(i=t,s=e[i]||this.options_[i]||{}):(i=t.name,s=t),{name:i,opts:s}})).filter((e=>{const t=Il.getComponent(e.opts.componentClass||kl(e.name));return t&&!r.isTech(t)})).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)}$(e,t){return Po(e,t||this.contentEl())}$$(e,t){return Oo(e,t||this.contentEl())}hasClass(e){return co(this.el_,e)}addClass(...e){po(this.el_,...e)}removeClass(...e){mo(this.el_,...e)}toggleClass(e,t){go(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return _o(this.el_,e)}setAttribute(e,t){bo(this.el_,e,t)}removeAttribute(e){vo(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;const s=this.el_.style[e],r=s.indexOf("px");return-1!==r?parseInt(s.slice(0,r),10):parseInt(this.el_["offset"+kl(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=No(this.el_,e),t=parseFloat(t),0===t||isNaN(t)){const i=`offset${kl(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(w.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,s=200;let r;this.on("touchstart",(function(i){1===i.touches.length&&(t={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},e=g.performance.now(),r=!0)})),this.on("touchmove",(function(e){if(e.touches.length>1)r=!1;else if(t){const s=e.touches[0].pageX-t.pageX,n=e.touches[0].pageY-t.pageY;Math.sqrt(s*s+n*n)>i&&(r=!1)}}));const n=function(){r=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(i){if(t=null,!0===r){g.performance.now()-e<s&&(i.preventDefault(),this.trigger("tap"))}}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=nl(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",(function(){e(),this.clearInterval(t),t=this.setInterval(e,250)}));const i=function(i){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=nl(this,e),this.clearTimersOnDispose_(),i=g.setTimeout((()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),g.clearTimeout(e)),e}setInterval(e,t){e=nl(this,e),this.clearTimersOnDispose_();const i=g.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),g.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=nl(this,e),t=g.requestAnimationFrame((()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()})),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=nl(this,t);const i=this.requestAnimationFrame((()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}));return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),g.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((([e,t])=>{this[e].forEach(((e,i)=>this[t](i)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(e,t){if("string"!=typeof e||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=Il.getComponent("Tech"),s=i&&i.isTech(t),r=Il===t||Il.prototype.isPrototypeOf(t.prototype);if(s||!r){let t;throw t=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${e}"; ${t}.`)}e=kl(e),Il.components_||(Il.components_={});const n=Il.getComponent("Player");if("Player"===e&&n&&n.players){const e=n.players,t=Object.keys(e);if(e&&t.length>0&&t.map((t=>e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return Il.components_[e]=t,Il.components_[wl(e)]=t,t}static getComponent(e){if(e&&Il.components_)return Il.components_[e]}}function Al(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${t}) is non-numeric or out of bounds (0-${i}).`)}function Dl(e,t,i,s){return Al(e,s,i.length-1),i[s][t]}function Ll(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Dl.bind(null,"start",0,e),end:Dl.bind(null,"end",1,e)},g.Symbol&&g.Symbol.iterator&&(t[g.Symbol.iterator]=()=>(e||[]).values()),t}function Pl(e,t){return Array.isArray(e)?Ll(e):void 0===e||void 0===t?Ll():Ll([[e,t]])}Il.registerComponent("Component",Il);const Ol=function(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);const n=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=s=i="-"),r=r>0||a>0?r+":":"",s=((r||n>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,r+s+i};let Nl=Ol;function Rl(e){Nl=e}function Ml(){Nl=Ol}function Ul(e,t=e){return Nl(e,t)}var Bl=Object.freeze({__proto__:null,createTimeRanges:Pl,createTimeRange:Pl,setFormatTime:Rl,resetFormatTime:Ml,formatTime:Ul});function Fl(e,t){let i,s,r=0;if(!t)return 0;e&&e.length||(e=Pl(0,0));for(let n=0;n<e.length;n++)i=e.start(n),s=e.end(n),s>t&&(s=t),r+=s-i;return r/t}function jl(e){if(e instanceof jl)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:La(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=jl.defaultMessages[this.code]||"")}jl.prototype.code=0,jl.prototype.message="",jl.prototype.status=null,jl.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],jl.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let Yf=0;Yf<jl.errorTypes.length;Yf++)jl[jl.errorTypes[Yf]]=Yf,jl.prototype[jl.errorTypes[Yf]]=Yf;function ql(e){return null!=e&&"function"==typeof e.then}function $l(e){ql(e)&&e.then(null,(e=>{}))}const Vl=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((t,i,s)=>(e[i]&&(t[i]=e[i]),t)),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})};var Hl={textTracksToJson:function(e){const t=e.$$("track"),i=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){const t=Vl(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(Vl))},jsonToTextTracks:function(e,t){return e.forEach((function(e){const i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((e=>i.addCue(e)))})),t.textTracks()},trackToJson_:Vl};const Wl="vjs-modal-dialog";class Gl extends Il{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=lo("div",{className:`${Wl}-content`},{role:"document"}),this.descEl_=lo("p",{className:`${Wl}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),uo(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Wl} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(!this.opened_){const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if("boolean"==typeof e){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const e=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Do(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_)}empty(){this.trigger("beforemodalempty"),xo(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){const e=S.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),w.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(!w.isEventKey(e,"Tab"))return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let s;for(let r=0;r<t.length;r++)if(i===t[r]){s=r;break}S.activeElement===this.el_&&(s=0),e.shiftKey&&0===s?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||s!==t.length-1||(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(e=>(e instanceof g.HTMLAnchorElement||e instanceof g.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof g.HTMLInputElement||e instanceof g.HTMLSelectElement||e instanceof g.HTMLTextAreaElement||e instanceof g.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof g.HTMLIFrameElement||e instanceof g.HTMLObjectElement||e instanceof g.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")))}}Gl.prototype.options_={pauseOnOpen:!0,temporary:!0},Il.registerComponent("ModalDialog",Gl);class zl extends dl{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},cl(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const s=this[i];if(s.id===e){t=s;break}}return t}}zl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const Qf in zl.prototype.allowedEvents_)zl.prototype["on"+Qf]=null;const Xl=function(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)};class Kl extends zl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Xl(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Xl(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Xl(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Yl=function(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)};class Ql extends zl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Yl(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set(){}})}addTrack(e){e.selected&&Yl(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Yl(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Jl extends zl{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class Zl{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,s=this.trackElements_.length;i<s;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class eu{constructor(e){eu.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const s=e.length;this.cues_=e,this.length_=e.length;const r=function(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})};if(t<s)for(i=t;i<s;i++)r.call(this,i)}getCueById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const s=this[i];if(s.id===e){t=s;break}}return t}}const tu={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},iu={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},su={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},ru={disabled:"disabled",hidden:"hidden",showing:"showing"};class nu extends dl{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Go(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const s in t)Object.defineProperty(this,s,{get:()=>t[s],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}const au=function(e){const t=["protocol","hostname","port","pathname","search","hash","host"],i=S.createElement("a");i.href=e;const s={};for(let r=0;r<t.length;r++)s[t[r]]=i[t[r]];return"http:"===s.protocol&&(s.host=s.host.replace(/:80$/,"")),"https:"===s.protocol&&(s.host=s.host.replace(/:443$/,"")),s.protocol||(s.protocol=g.location.protocol),s.host||(s.host=g.location.host),s},ou=function(e){if(!e.match(/^https?:\/\//)){const t=S.createElement("a");t.href=e,e=t.href}return e},lu=function(e){if("string"==typeof e){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},uu=function(e,t=g.location){const i=au(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host};var du=Object.freeze({__proto__:null,parseUrl:au,getAbsoluteURL:ou,getFileExtension:lu,isCrossOrigin:uu});const hu=function(e,t){const i=new g.WebVTT.Parser(g,g.vttjs,g.WebVTT.StringDecoder()),s=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){s.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),s.length>0&&(g.console&&g.console.groupCollapsed&&g.console.groupCollapsed(`Text Track parsing errors for ${t.src}`),s.forEach((e=>ka.error(e))),g.console&&g.console.groupEnd&&g.console.groupEnd()),i.flush()},cu=function(e,t){const i={uri:e},s=uu(e);s&&(i.cors=s);const r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),z(i,nl(this,(function(e,i,s){if(e)return ka.error(e,i);t.loaded_=!0,"function"!=typeof g.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return hu(s,t);ka.error(`vttjs failed to load, stopping trying to process ${t.src}`)})):hu(s,t)})))};class pu extends nu{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Oa(e,{kind:su[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=ru[t.mode]||"disabled";const s=t.default;"metadata"!==t.kind&&"chapters"!==t.kind||(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;const r=new eu(this.cues_),n=new eu(this.activeCues_);let a=!1;this.timeupdateHandler=nl(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,a&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));const o=()=>{this.stopTracking()};this.tech_.one("dispose",o),"disabled"!==i&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>s,set(){}},mode:{get:()=>i,set(e){ru[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||cu(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return n;const e=this.tech_.currentTime(),t=[];for(let i=0,s=this.cues.length;i<s;i++){const s=this.cues[i];s.startTime<=e&&s.endTime>=e&&t.push(s)}if(a=!1,t.length!==this.activeCues_.length)a=!0;else for(let i=0;i<t.length;i++)-1===this.activeCues_.indexOf(t[i])&&(a=!0);return this.activeCues_=t,n.setCues_(this.activeCues_),n},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||"subtitles"!==t.kind&&"captions"!==t.kind)&&cu(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(g.vttjs&&!(e instanceof g.vttjs.VTTCue)){t=new g.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const i in e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let s=0;s<i.length;s++)i[s]!==this&&i[s].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}pu.prototype.allowedEvents_={cuechange:"cuechange"};class mu extends nu{constructor(e={}){const t=Oa(e,{kind:iu[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class gu extends nu{constructor(e={}){const t=Oa(e,{kind:tu[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class fu extends dl{constructor(e={}){let t;super();const i=new pu(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>i}}),t=fu.NONE,i.addEventListener("loadeddata",(()=>{t=fu.LOADED,this.trigger({type:"load",target:this})}))}}fu.prototype.allowedEvents_={load:"load"},fu.NONE=0,fu.LOADING=1,fu.LOADED=2,fu.ERROR=3;const yu={audio:{ListClass:Kl,TrackClass:mu,capitalName:"Audio"},video:{ListClass:Ql,TrackClass:gu,capitalName:"Video"},text:{ListClass:Jl,TrackClass:pu,capitalName:"Text"}};Object.keys(yu).forEach((function(e){yu[e].getterName=`${e}Tracks`,yu[e].privateName=`${e}Tracks_`}));const _u={remoteText:{ListClass:Jl,TrackClass:pu,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Zl,TrackClass:fu,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},bu=Object.assign({},yu,_u);function vu(e,t,i,s,r={}){const n=e.textTracks();r.kind=t,i&&(r.label=i),s&&(r.language=s),r.tech=e;const a=new bu.text.TrackClass(r);return n.addTrack(a),a}_u.names=Object.keys(_u),yu.names=Object.keys(yu),bu.names=[].concat(_u.names).concat(yu.names);class Tu extends Il{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",(function(){this.hasStarted_=!0})),this.on("loadstart",(function(){this.hasStarted_=!1})),bu.names.forEach((t=>{const i=bu[t];e&&e[i.getterName]&&(this[i.privateName]=e[i.getterName])})),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((t=>{!1===e[`native${t}Tracks`]&&(this[`featuresNative${t}Tracks`]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new bu.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",(()=>this.setTimeout((()=>this.triggerSourceset(e)),1))),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(nl(this,(function(){const e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Pl(0,0)}bufferedPercent(){return Fl(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(yu.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach((e=>{const t=this[`${e}Tracks`]()||[];let i=t.length;for(;i--;){const s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}}))}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new jl(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Pl(0,0):Pl()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){yu.names.forEach((e=>{const t=yu[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",(()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)}))}))}addWebVttScript_(){if(!g.WebVTT)if(S.body.contains(this.el())){if(!this.options_["vtt.js"]&&Pa(Fe)&&Object.keys(Fe).length>0)return void this.trigger("vttjsloaded");const e=S.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",(()=>{e.onload=null,e.onerror=null})),g.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),s=t=>e.removeTrack(t.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),n=()=>{r();for(let t=0;t<e.length;t++){const i=e[t];i.removeEventListener("cuechange",r),"showing"===i.mode&&i.addEventListener("cuechange",r)}};n(),e.addEventListener("change",n),e.addEventListener("addtrack",n),e.addEventListener("removetrack",n),this.on("dispose",(function(){t.off("addtrack",i),t.off("removetrack",s),e.removeEventListener("change",n),e.removeEventListener("addtrack",n),e.removeEventListener("removetrack",n);for(let t=0;t<e.length;t++){e[t].removeEventListener("cuechange",r)}}))}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return vu(this,e,t,i)}createRemoteTextTrack(e){const t=Oa(e,{tech:this});return new _u.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return"boolean"!=typeof t&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===t&&this.ready((()=>this.autoRemoteTextTracks_.addTrack(i.track))),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Go();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",(()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())}))):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Tu.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Tu||e instanceof Tu||e===Tu}static registerTech(e,t){if(Tu.techs_||(Tu.techs_={}),!Tu.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Tu.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Tu.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=kl(e),Tu.techs_[e]=t,Tu.techs_[wl(e)]=t,"Tech"!==e&&Tu.defaultTechOrder_.push(e),t}static getTech(e){if(e)return Tu.techs_&&Tu.techs_[e]?Tu.techs_[e]:(e=kl(e),g&&g.videojs&&g.videojs[e]?(ka.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),g.videojs[e]):void 0)}}bu.names.forEach((function(e){const t=bu[e];Tu.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Tu.prototype.featuresVolumeControl=!0,Tu.prototype.featuresMuteControl=!0,Tu.prototype.featuresFullscreenResize=!1,Tu.prototype.featuresPlaybackRate=!1,Tu.prototype.featuresProgressEvents=!1,Tu.prototype.featuresSourceset=!1,Tu.prototype.featuresTimeupdateEvents=!1,Tu.prototype.featuresNativeTextTracks=!1,Tu.prototype.featuresVideoFrameCallback=!1,Tu.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let s=e.sourceHandlers;s||(s=e.sourceHandlers=[]),void 0===i&&(i=s.length),s.splice(i,0,t)},e.canPlayType=function(t){const i=e.sourceHandlers||[];let s;for(let e=0;e<i.length;e++)if(s=i[e].canPlayType(t),s)return s;return""},e.selectSourceHandler=function(t,i){const s=e.sourceHandlers||[];let r;for(let e=0;e<s.length;e++)if(r=s[e].canHandleSource(t,i),r)return s[e];return null},e.canPlaySource=function(t,i){const s=e.selectSourceHandler(t,i);return s?s.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){const t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){let i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:ka.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Il.registerComponent("Tech",Tu),Tu.registerTech("Tech",Tu),Tu.defaultTechOrder_=[];const Su={},Eu={},wu={};function ku(e,t){Su[e]=Su[e]||[],Su[e].push(t)}function Cu(e,t,i){e.setTimeout((()=>Bu(t,Su[t.type],i,e)),1)}function xu(e,t){e.forEach((e=>e.setTech&&e.setTech(t)))}function Iu(e,t,i){return e.reduceRight(Nu(i),t[i]())}function Au(e,t,i,s){return t[i](e.reduce(Nu(i),s))}function Du(e,t,i,s=null){const r="call"+kl(i),n=e.reduce(Nu(r),s),a=n===wu,o=a?null:t[i](n);return Ru(e,i,o,a),o}const Lu={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Pu={setCurrentTime:1,setMuted:1,setVolume:1},Ou={play:1,pause:1};function Nu(e){return(t,i)=>t===wu?wu:i[e]?i[e](t):t}function Ru(e,t,i,s){for(let r=e.length-1;r>=0;r--){const n=e[r];n[t]&&n[t](s,i)}}function Mu(e){Eu[e.id()]=null}function Uu(e,t){const i=Eu[e.id()];let s=null;if(null==i)return s=t(e),Eu[e.id()]=[[t,s]],s;for(let r=0;r<i.length;r++){const[e,n]=i[r];e===t&&(s=n)}return null===s&&(s=t(e),i.push([t,s])),s}function Bu(e={},t=[],i,s,r=[],n=!1){const[a,...o]=t;if("string"==typeof a)Bu(e,Su[a],i,s,r,n);else if(a){const t=Uu(s,a);if(!t.setSource)return r.push(t),Bu(e,o,i,s,r,n);t.setSource(Object.assign({},e),(function(a,l){if(a)return Bu(e,o,i,s,r,n);r.push(t),Bu(l,e.type===l.type?o:Su[l.type],i,s,r,n)}))}else o.length?Bu(e,o,i,s,r,n):n?i(e,r):Bu(e,Su["*"],i,s,r,!0)}const Fu={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},ju=function(e=""){const t=lu(e);return Fu[t.toLowerCase()]||""},qu=(e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;const i=e.cache_.sources.filter((e=>e.src===t));if(i.length)return i[0].type;const s=e.$$("source");for(let r=0;r<s.length;r++){const e=s[r];if(e.type&&e.src&&e.src===t)return e.type}return ju(t)},$u=function(e){if(Array.isArray(e)){let t=[];e.forEach((function(e){e=$u(e),Array.isArray(e)?t=t.concat(e):La(e)&&t.push(e)})),e=t}else e="string"==typeof e&&e.trim()?[Vu({src:e})]:La(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[Vu(e)]:[];return e};function Vu(e){if(!e.type){const t=ju(e.src);t&&(e.type=t)}return e}class Hu extends Il{constructor(e,t,i){if(super(e,Oa({createEl:!1},t),i),t.playerOptions.sources&&0!==t.playerOptions.sources.length)e.src(t.playerOptions.sources);else for(let s=0,r=t.playerOptions.techOrder;s<r.length;s++){const t=kl(r[s]);let i=Tu.getTech(t);if(t||(i=Il.getComponent(t)),i&&i.isSupported()){e.loadTech_(t);break}}}}Il.registerComponent("MediaLoader",Hu);class Wu extends Il{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=e=>this.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&ka.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const s=lo(e,t,i);return s.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=lo("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,uo(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){w.isEventKey(e,"Space")||w.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Il.registerComponent("ClickableComponent",Wu);class Gu extends Wu{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return lo("div",{className:"vjs-poster"})}crossOrigin(e){if(void 0===e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null===e||"anonymous"===e||"use-credentials"===e?this.$("img")&&(this.$("img").crossOrigin=e):this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(lo("picture",{className:"vjs-poster",tabIndex:-1},{},lo("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?$l(this.player_.play()):this.player_.pause())}}Gu.prototype.crossorigin=Gu.prototype.crossOrigin,Il.registerComponent("PosterImage",Gu);const zu="#222",Xu="#ccc",Ku={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Yu(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Qu(e,t,i){try{e.style[t]=i}catch(Gf){return}}class Ju extends Il{constructor(e,t,i){super(e,t,i);const s=e=>this.updateDisplay(e);e.on("loadstart",(e=>this.toggleDisplay(e))),e.on("texttrackchange",s),e.on("loadedmetadata",(e=>this.preselectTrack(e))),e.ready(nl(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)return void this.hide();e.on("fullscreenchange",s),e.on("playerresize",s);const t=g.screen.orientation||g,i=g.screen.orientation?"change":"orientationchange";t.addEventListener(i,s),e.on("dispose",(()=>t.removeEventListener(i,s)));const r=this.options_.playerOptions.tracks||[];for(let e=0;e<r.length;e++)this.player_.addRemoteTextTrack(r[e],!0);this.preselectTrack()})))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let s,r,n;for(let a=0;a<t.length;a++){const o=t[a];i&&i.enabled&&i.language&&i.language===o.language&&o.kind in e?o.kind===i.kind?n=o:n||(n=o):i&&!i.enabled?(n=null,s=null,r=null):o.default&&("descriptions"!==o.kind||s?o.kind in e&&!r&&(r=o):s=o)}n?n.mode="showing":r?r.mode="showing":s&&(s.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){"function"==typeof g.WebVTT&&g.WebVTT.processCues(g,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const t=[];for(let i=0;i<e.length;++i){const s=e[i];"showing"===s.mode&&t.push(s)}return void this.updateForTrack(t)}let i=null,s=null,r=e.length;for(;r--;){const t=e[r];"showing"===t.mode&&("descriptions"===t.kind?i=t:s=t)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):i&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){const e=i[s];if(!e)continue;const r=e.displayState;if(t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&Qu(r.firstChild,"color",Yu(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Qu(r.firstChild,"backgroundColor",Yu(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Qu(r,"backgroundColor",Yu(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow=`2px 2px 3px ${zu}, 2px 2px 4px ${zu}, 2px 2px 5px ${zu}`:"raised"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${zu}, 2px 2px ${zu}, 3px 3px ${zu}`:"depressed"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${Xu}, 0 1px ${Xu}, -1px -1px ${zu}, 0 -1px ${zu}`:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow=`0 0 4px ${zu}, 0 0 4px ${zu}, 0 0 4px ${zu}, 0 0 4px ${zu}`)),t.fontPercent&&1!==t.fontPercent){const e=g.parseFloat(r.style.fontSize);r.style.fontSize=e*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=Ku[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof g.WebVTT||e.every((e=>!e.activeCues)))return;const t=[];for(let i=0;i<e.length;++i){const s=e[i];for(let e=0;e<s.activeCues.length;++e)t.push(s.activeCues[e])}g.WebVTT.processCues(g,t,this.el_);for(let i=0;i<e.length;++i){const t=e[i];for(let e=0;e<t.activeCues.length;++e){const s=t.activeCues[e].displayState;po(s,"vjs-text-track-cue","vjs-text-track-cue-"+(t.language?t.language:i)),t.language&&bo(s,"lang",t.language)}this.player_.textTrackSettings&&this.updateDisplayState(t)}}}Il.registerComponent("TextTrackDisplay",Ju);class Zu extends Il{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=lo("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}Il.registerComponent("LoadingSpinner",Zu);class ed extends Wu{createEl(e,t={},i={}){const s=lo("button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i));return s.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}addChild(e,t={}){const i=this.constructor.name;return ka.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),Il.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){w.isEventKey(e,"Space")||w.isEventKey(e,"Enter")?e.stopPropagation():super.handleKeyDown(e)}}Il.registerComponent("Button",ed);class td extends ed{constructor(e,t){super(e,t),this.mouseused_=!1,this.on("mousedown",(e=>this.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)return $l(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());const i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s)return void this.player_.tech(!0).focus();const r=()=>s.focus();ql(t)?t.then(r,(()=>{})):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}td.prototype.controlText_="Play Video",Il.registerComponent("BigPlayButton",td);class id extends ed{constructor(e,t){super(e,t),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){w.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Il.registerComponent("CloseButton",id);class sd extends ed{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.on(e,"play",(e=>this.handlePlay(e))),this.on(e,"pause",(e=>this.handlePause(e))),t.replay&&this.on(e,"ended",(e=>this.handleEnded(e)))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?$l(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}sd.prototype.controlText_="Play",Il.registerComponent("PlayToggle",sd);class rd extends Il{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],(e=>this.updateContent(e))),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=lo("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=lo("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ul(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(()=>{if(!this.contentEl_)return;let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,ka.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=S.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))})))}updateContent(e){}}rd.prototype.labelText_="Time",rd.prototype.controlText_="Time",Il.registerComponent("TimeDisplay",rd);class nd extends rd{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}nd.prototype.labelText_="Current Time",nd.prototype.controlText_="Current Time",Il.registerComponent("CurrentTimeDisplay",nd);class ad extends rd{constructor(e,t){super(e,t);const i=e=>this.updateContent(e);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}ad.prototype.labelText_="Duration",ad.prototype.controlText_="Duration",Il.registerComponent("DurationDisplay",ad);class od extends Il{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}Il.registerComponent("TimeDivider",od);class ld extends rd{constructor(e,t){super(e,t),this.on(e,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(lo("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"!=typeof this.player_.duration())return;let t;t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t)}}ld.prototype.labelText_="Remaining Time",ld.prototype.controlText_="Remaining Time",Il.registerComponent("RemainingTimeDisplay",ld);class ud extends Il{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=lo("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(lo("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(S.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}Il.registerComponent("LiveDisplay",ud);class dd extends ed{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=lo("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function hd(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}dd.prototype.controlText_="Seek to live, currently playing live",Il.registerComponent("SeekToLive",dd);var cd=Object.freeze({__proto__:null,clamp:hd});class pd extends Il{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Va||e.preventDefault(),To(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;So(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",(()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"}))),e}getProgress(){return Number(hd(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=ko(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){w.isEventKey(e,"Left")||w.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):w.isEventKey(e,"Right")||w.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}Il.registerComponent("Slider",pd);const md=(e,t)=>hd(e/t*100,0,100).toFixed(2)+"%";class gd extends Il{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",(e=>this.update(e)))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=lo("span",{className:"vjs-control-text"}),i=lo("span",{textContent:this.localize("Loaded")}),s=S.createTextNode(": ");return this.percentageEl_=lo("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",(()=>{const e=this.player_.liveTracker,t=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,n=md(s,i);this.percent_!==n&&(this.el_.style.width=n,uo(this.percentageEl_,n),this.percent_=n);for(let a=0;a<t.length;a++){const e=t.start(a),i=t.end(a);let n=r[a];n||(n=this.el_.appendChild(lo()),r[a]=n),n.dataset.start===e&&n.dataset.end===i||(n.dataset.start=e,n.dataset.end=i,n.style.left=md(e,s),n.style.width=md(i-e,s))}for(let a=r.length;a>t.length;a--)this.el_.removeChild(r[a-1]);r.length=t.length}))}}Il.registerComponent("LoadProgressBar",gd);class fd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const s=wo(this.el_),r=Eo(this.player_.el()),n=e.width*t;if(!r||!s)return;const a=e.left-r.left+n,o=e.width-n+(r.right-e.right);let l=s.width/2;a<l?l+=l-a:o<l&&(l=o),l<0?l=0:l>s.width&&(l=s.width),l=Math.round(l),this.el_.style.right=`-${l}px`,this.write(i)}write(e){uo(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let r;const n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const e=this.player_.liveTracker.liveWindow(),i=e-t*e;r=(i<1?"":"-")+Ul(i,e)}else r=Ul(i,n);this.update(e,t,r),s&&s()}))}}Il.registerComponent("TimeTooltip",fd);class yd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const i=this.getChild("timeTooltip");if(!i)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}yd.prototype.options_={children:[]},Za||Fa||yd.prototype.options_.children.push("timeTooltip"),Il.registerComponent("PlayProgressBar",yd);class _d extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,(()=>{this.el_.style.left=e.width*t+"px"}))}}_d.prototype.options_={children:["timeTooltip"]},Il.registerComponent("MouseTimeDisplay",_d);const bd=5,vd=12;class Td extends pd{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=nl(this,this.update),this.update=al(this.update_,rl),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in S&&"visibilityState"in S&&this.on(S,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===S.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,rl))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"===S.visibilityState)return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{const e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker;let s=this.player_.duration();i&&i.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ul(e,s),Ul(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Eo(this.el()),this.getProgress())})),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Lo(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Lo(e))return;let i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);const s=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(s>=.99)return void r.seekToLiveEdge();const e=r.seekableStart(),t=r.liveCurrentTime();if(i=e+s*r.liveWindow(),i>=t&&(i=t),i<=e&&(i=e+.1),i===1/0)return}else i=s*this.player_.duration(),i===this.player_.duration()&&(i-=.1);this.userSeek_(i)}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?$l(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+bd)}stepBack(){this.userSeek_(this.player_.currentTime()-bd)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(w.isEventKey(e,"Space")||w.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(w.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(w.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(w(e))){e.preventDefault(),e.stopPropagation();const i=10*(w.codes[w(e)]-w.codes[0])/100;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else w.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-bd*vd)):w.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+bd*vd)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in S&&"visibilityState"in S&&this.off(S,"visibilitychange",this.toggleVisibility_),super.dispose()}}Td.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Za||Fa||Td.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Il.registerComponent("SeekBar",Td);class Sd extends Il{constructor(e,t){super(e,t),this.handleMouseMove=al(nl(this,this.handleMouseMove),rl),this.throttledHandleMouseSeek=al(nl(this,this.handleMouseSeek),rl),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;const r=t.el(),n=wo(r);let a=ko(r,e).x;a=hd(a,0,1),s&&s.update(n,a),i&&i.update(n,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach((e=>e.disable&&e.disable())),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&$l(this.player_.play())}}enable(){this.children().forEach((e=>e.enable&&e.enable())),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Sd.prototype.options_={children:["seekBar"]},Il.registerComponent("ProgressControl",Sd);class Ed extends ed{constructor(e,t){super(e,t),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>{"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),this.hide()):this.show()})),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control ${super.buildCSSClass()}`}handlePictureInPictureEnabledChange(){S.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in g?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}Ed.prototype.controlText_="Picture-in-Picture",Il.registerComponent("PictureInPictureToggle",Ed);class wd extends ed{constructor(e,t){super(e,t),this.on(e,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===S[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}wd.prototype.controlText_="Fullscreen",Il.registerComponent("FullscreenToggle",wd);const kd=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))};class Cd extends Il{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}Il.registerComponent("VolumeLevel",Cd);class xd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){const i=Eo(this.el_),s=Eo(this.player_.el()),r=e.width*t;if(!s||!i)return;const n=e.left-s.left+r,a=e.width-r+(s.right-e.right);let o=i.width/2;n<o?o+=o-n:a<o&&(o=a),o<0?o=0:o>i.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${s}%`)}write(e){uo(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,i,s.toFixed(0)),r&&r()}))}}Il.registerComponent("VolumeLevelTooltip",xd);class Id extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,(()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}Id.prototype.options_={children:["volumeLevelTooltip"]},Il.registerComponent("MouseVolumeLevelDisplay",Id);class Ad extends pd{constructor(e,t){super(e,t),this.on("slideractive",(e=>this.updateLastVolume_(e))),this.on(e,"volumechange",(e=>this.updateARIAAttributes(e))),e.ready((()=>this.updateARIAAttributes()))}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Lo(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),s=Eo(i),r=this.vertical();let n=ko(i,e);n=r?n.y:n.x,n=hd(n,0,1),t.update(s,n,r)}Lo(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}Ad.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Za||Fa||Ad.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Ad.prototype.playerEvent="volumechange",Il.registerComponent("VolumeBar",Ad);class Dd extends Il{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||Pa(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),kd(this,e),this.throttledHandleMouseMove=al(nl(this,this.handleMouseMove),rl),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",(e=>this.handleMouseDown(e))),this.on("touchstart",(e=>this.handleMouseDown(e))),this.on("mousemove",(e=>this.handleMouseMove(e))),this.on(this.volumeBar,["focus","slideractive"],(()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")})),this.on(this.volumeBar,["blur","sliderinactive"],(()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")}))}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Dd.prototype.options_={children:["volumeBar"]},Il.registerComponent("VolumeControl",Dd);const Ld=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))};class Pd extends ed{constructor(e,t){super(e,t),Ld(this,e),this.on(e,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){const e=i<.1?.1:i;this.player_.volume(e),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;Za&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),mo(this.el_,[0,1,2,3].reduce(((e,t)=>e+`${t?" ":""}vjs-vol-${t}`),"")),po(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Pd.prototype.controlText_="Mute",Il.registerComponent("MuteToggle",Pd);class Od extends Il{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||Pa(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],(e=>this.volumePanelState_(e))),this.on(this.muteToggle,"keyup",(e=>this.handleKeyPress(e))),this.on(this.volumeControl,"keyup",(e=>this.handleVolumeControlKeyUp(e))),this.on("keydown",(e=>this.handleKeyPress(e))),this.on("mouseover",(e=>this.handleMouseOver(e))),this.on("mouseout",(e=>this.handleMouseOut(e))),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){w.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Jo(S,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Zo(S,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){w.isEventKey(e,"Esc")&&this.handleMouseOut()}}Od.prototype.options_={children:["muteToggle","volumeControl"]},Il.registerComponent("VolumePanel",Od);class Nd extends ed{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;r=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Il.registerComponent("SkipForward",Nd);class Rd extends ed{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart();let r;r=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Rd.prototype.controlText_="Skip Backward",Il.registerComponent("SkipBackward",Rd);class Md extends Il{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",(e=>this.handleKeyDown(e))),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof Il&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Il&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=lo(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),Jo(t,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||S.activeElement;if(!this.children().some((e=>e.el()===t))){const e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter((t=>t.el()===e.target))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}}handleKeyDown(e){w.isEventKey(e,"Left")||w.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(w.isEventKey(e,"Right")||w.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}Il.registerComponent("Menu",Md);class Ud extends Il{constructor(e,t={}){super(e,t),this.menuButton_=new ed(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=ed.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",(e=>this.handleKeyDown(e))),this.on(this.menuButton_,"mouseenter",(()=>{this.addClass("vjs-hover"),this.menu.show(),Jo(S,"keyup",this.handleMenuKeyUp_)})),this.on("mouseleave",(e=>this.handleMouseLeave(e))),this.on("keydown",(e=>this.handleSubmenuKeyDown(e)))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Md(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=lo("li",{className:"vjs-menu-title",textContent:kl(this.options_.title),tabIndex:-1}),i=new Il(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}buildWrapperCSSClass(){let e="vjs-menu-button";!0===this.options_.inline?e+="-inline":e+="-popup";return`vjs-menu-button ${e} ${ed.prototype.buildCSSClass()} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),Zo(S,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),w.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(w.isEventKey(e,"Up")||w.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),w.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Za&&ao())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}Il.registerComponent("MenuButton",Ud);class Bd extends Ud{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const s=nl(this,this.update);i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),i.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",(function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s),i.removeEventListener("labelchange",s)}))}}Il.registerComponent("TrackButton",Bd);const Fd=["Tab","Esc","Up","Down","Right","Left"];class jd extends Wu{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i);return s.replaceChild(lo("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),s.querySelector(".vjs-icon-placeholder")),s}handleKeyDown(e){Fd.some((t=>w.isEventKey(e,t)))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}Il.registerComponent("MenuItem",jd);class qd extends jd{constructor(e,t){const i=t.track,s=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const r=(...e)=>{this.handleTracksChange.apply(this,e)},n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)})),void 0===s.onchange){let e;this.on(["tap","click"],(function(){if("object"!=typeof g.Event)try{e=new g.Event("change")}catch(t){}e||(e=S.createEvent("Event"),e.initEvent("change",!0,!0)),s.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let s=0;s<i.length;s++){const e=i[s];-1!==this.kinds.indexOf(e.kind)&&(e===t?"showing"!==e.mode&&(e.mode="showing"):"disabled"!==e.mode&&(e.mode="disabled"))}}handleTracksChange(e){const t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if("showing"===this.track.mode){const e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}Il.registerComponent("TextTrackMenuItem",qd);class $d extends qd{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(this.options_.kinds.indexOf(e.kind)>-1&&"showing"===e.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(["captions","descriptions","subtitles"].indexOf(e.kind)>-1&&"showing"===e.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}Il.registerComponent("OffTextTrackMenuItem",$d);class Vd extends Bd{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=qd){let i;this.label_&&(i=`${this.label_} off`),e.push(new $d(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r<s.length;r++){const i=s[r];if(this.kinds_.indexOf(i.kind)>-1){const s=new t(this.player_,{track:i,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass(`vjs-${i.kind}-menu-item`),e.push(s)}}return e}}Il.registerComponent("TextTrackButton",Vd);class Hd extends jd{constructor(e,t){const i=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r<s.endTime,super(e,t),this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}Il.registerComponent("ChaptersTrackMenuItem",Hd);class Wd extends Vd{constructor(e,t,i){super(e,t,i),this.selectCurrentItem_=()=>{this.items.forEach((e=>{e.selected(this.track_.activeCues[0]===e.cue)}))}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&"chapters"!==e.track.kind)return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(kl(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,s=t.length;i<s;i++){const s=t[i],r=new Hd(this.player_,{track:this.track_,cue:s});e.push(r)}return e}}Wd.prototype.kind_="chapters",Wd.prototype.controlText_="Chapters",Il.registerComponent("ChaptersButton",Wd);class Gd extends Vd{constructor(e,t,i){super(e,t,i);const s=e.textTracks(),r=nl(this,this.handleTracksChange);s.addEventListener("change",r),this.on("dispose",(function(){s.removeEventListener("change",r)}))}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(e.kind!==this.kind_&&"showing"===e.mode){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Gd.prototype.kind_="descriptions",Gd.prototype.controlText_="Descriptions",Il.registerComponent("DescriptionsButton",Gd);class zd extends Vd{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}zd.prototype.kind_="subtitles",zd.prototype.controlText_="Subtitles",Il.registerComponent("SubtitlesButton",zd);class Xd extends qd{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}Il.registerComponent("CaptionSettingsMenuItem",Xd);class Kd extends Vd{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Xd(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Kd.prototype.kind_="captions",Kd.prototype.controlText_="Captions",Il.registerComponent("CaptionsButton",Kd);class Yd extends qd{createEl(e,t,i){const s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(r.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(lo("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),s}}Il.registerComponent("SubsCapsMenuItem",Yd);class Qd extends Vd{constructor(e,t={}){super(e,t),this.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions"),this.menuButton_.controlText(kl(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Xd(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Yd),e}}Qd.prototype.kinds_=["captions","subtitles"],Qd.prototype.controlText_="Subtitles",Il.registerComponent("SubsCapsButton",Qd);class Jd extends jd{constructor(e,t){const i=t.track,s=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...e)=>{this.handleTracksChange.apply(this,e)};s.addEventListener("change",r),this.on("dispose",(()=>{s.removeEventListener("change",r)}))}createEl(e,t,i){const s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(r.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(lo("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const e=this.player_.audioTracks();for(let t=0;t<e.length;t++){const i=e[t];i!==this.track&&(i.enabled=i===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}Il.registerComponent("AudioTrackMenuItem",Jd);class Zd extends Bd{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t)}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const s=t[i];e.push(new Jd(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}Zd.prototype.controlText_="Audio Track",Il.registerComponent("AudioTrackButton",Zd);class eh extends jd{constructor(e,t){const i=t.rate,s=parseFloat(i,10);t.label=i,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=s,this.on(e,"ratechange",(e=>this.update(e)))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}eh.prototype.contentElType="button",Il.registerComponent("PlaybackRateMenuItem",eh);class th extends Ud{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(e=>this.updateVisibility(e))),this.on(e,"ratechange",(e=>this.updateLabel(e))),this.on(e,"playbackrateschange",(e=>this.handlePlaybackRateschange(e)))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=lo("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new eh(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}th.prototype.controlText_="Playback Rate",Il.registerComponent("PlaybackRateMenuButton",th);class ih extends Il{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Il.registerComponent("Spacer",ih);class sh extends ih{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Il.registerComponent("CustomControlSpacer",sh);class rh extends Il{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}rh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in S&&rh.prototype.options_.children.splice(rh.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Il.registerComponent("ControlBar",rh);class nh extends Gl{constructor(e,t){super(e,t),this.on(e,"error",(e=>this.open(e)))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}nh.prototype.options_=Object.assign({},Gl.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Il.registerComponent("ErrorDisplay",nh);const ah="vjs-text-track-settings",oh=["#000","Black"],lh=["#00F","Blue"],uh=["#0FF","Cyan"],dh=["#0F0","Green"],hh=["#F0F","Magenta"],ch=["#F00","Red"],ph=["#FFF","White"],mh=["#FF0","Yellow"],gh=["1","Opaque"],fh=["0.5","Semi-Transparent"],yh=["0","Transparent"],_h={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[oh,ph,ch,dh,lh,mh,hh,uh]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[gh,fh,yh]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ph,oh,ch,dh,lh,mh,hh,uh]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[gh,fh]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[yh,fh,gh]}};function bh(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}function vh(e,t){return bh(e.options[e.options.selectedIndex].value,t)}function Th(e,t,i){if(t)for(let s=0;s<e.options.length;s++)if(bh(e.options[s].value,i)===t){e.selectedIndex=s;break}}_h.windowColor.options=_h.backgroundColor.options;class Sh extends Gl{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=lo("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",(()=>{this.saveSettings(),this.close()})),this.on(this.$(".vjs-default-button"),"click",(()=>{this.setDefaults(),this.updateDisplay()})),Aa(_h,(e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){const s=_h[e],r=s.id.replace("%s",this.id_),n=[t,r].join(" ").trim();return[`<${i} id="${r}" class="${"label"===i?"vjs-label":""}">`,this.localize(s.label),`</${i}>`,`<select aria-labelledby="${n}">`].concat(s.options.map((e=>{const t=r+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${n} ${t}">`,this.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['<fieldset class="vjs-fg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",'<span class="vjs-text-color">',this.createElSelect_("color",e),"</span>",'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['<fieldset class="vjs-bg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text Background"),"</legend>",'<span class="vjs-bg-color">',this.createElSelect_("backgroundColor",e),"</span>",'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['<fieldset class="vjs-window vjs-track-setting">',`<legend id="${e}">`,this.localize("Caption Area Background"),"</legend>",'<span class="vjs-window-color">',this.createElSelect_("windowColor",e),"</span>",'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return lo("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return lo("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return lo("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Da(_h,((e,t,i)=>{const s=vh(this.$(t.selector),t.parser);return void 0!==s&&(e[i]=s),e}),{})}setValues(e){Aa(_h,((t,i)=>{Th(this.$(t.selector),e[i],t.parser)}))}setDefaults(){Aa(_h,(e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(g.localStorage.getItem(ah))}catch(t){ka.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?g.localStorage.setItem(ah,JSON.stringify(e)):g.localStorage.removeItem(ah)}catch(t){ka.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()}handleLanguagechange(){this.fill()}}Il.registerComponent("TextTrackSettings",Sh);class Eh extends Il{constructor(e,t){let i=t.ResizeObserver||g.ResizeObserver;null===t.ResizeObserver&&(i=!1);super(e,Oa({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||g.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=ol((()=>{this.resizeHandler()}),100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const e=this.debouncedHandler_;let t=this.unloadListener_=function(){Zo(this,"resize",e),Zo(this,"unload",t),t=null};Jo(this.el_.contentWindow,"unload",t),Jo(this.el_.contentWindow,"resize",e)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}Il.registerComponent("ResizeManager",Eh);const wh={trackingThreshold:20,liveTolerance:15};class kh extends Il{constructor(e,t){super(e,Oa(wh,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",(e=>this.handleDurationchange(e))),this.on(this.player_,"canplay",(()=>this.toggleTracking()))}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(g.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const s=this.liveCurrentTime(),r=this.player_.currentTime();let n=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-r)>this.options_.liveTolerance;this.timeupdateSeen_&&s!==1/0||(n=!1),n!==this.behindLiveEdge_&&(this.behindLiveEdge_=n,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,rl),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}Il.registerComponent("LiveTracker",kh);class Ch extends Il{constructor(e,t){super(e,t),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:lo("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Go()}`}),description:lo("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Go()}`})},lo("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{const s=this.state[e],r=this.els[e],n=i[e];xo(r),s&&uo(r,s),t&&(t.removeAttribute(n),s&&t.setAttribute(n,r.id))})),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}Il.registerComponent("TitleBar",Ch);const xh=e=>{const t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;const i=e.$$("source"),s=[];let r="";if(!i.length)return!1;for(let n=0;n<i.length;n++){const e=i[n].src;e&&-1===s.indexOf(e)&&s.push(e)}return!!s.length&&(1===s.length&&(r=s[0]),e.triggerSourceset(r),!0)},Ih=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){const t=S.createElement(this.nodeName.toLowerCase());t.innerHTML=e;const i=S.createDocumentFragment();for(;t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",g.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Ah=(e,t)=>{let i={};for(let s=0;s<e.length&&(i=Object.getOwnPropertyDescriptor(e[s],t),!(i&&i.set&&i.get));s++);return i.enumerable=!0,i.configurable=!0,i},Dh=e=>Ah([e.el(),g.HTMLMediaElement.prototype,g.Element.prototype,Ih],"innerHTML"),Lh=function(e){const t=e.el();if(t.resetSourceWatch_)return;const i={},s=Dh(e),r=i=>(...s)=>{const r=i.apply(t,s);return xh(e),r};["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",Oa(s,{set:r(s.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach((e=>{t[e]=i[e]})),Object.defineProperty(t,"innerHTML",s)},e.one("sourceset",t.resetSourceWatch_)},Ph=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ou(g.Element.prototype.getAttribute.call(this,"src")):""},set(e){return g.Element.prototype.setAttribute.call(this,"src",e),e}}),Oh=e=>Ah([e.el(),g.HTMLMediaElement.prototype,Ph],"src"),Nh=function(e){if(!e.featuresSourceset)return;const t=e.el();if(t.resetSourceset_)return;const i=Oh(e),s=t.setAttribute,r=t.load;Object.defineProperty(t,"src",Oa(i,{set:s=>{const r=i.set.call(t,s);return e.triggerSourceset(t.src),r}})),t.setAttribute=(i,r)=>{const n=s.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),n},t.load=()=>{const i=r.call(t);return xh(e)||(e.triggerSourceset(""),Lh(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):xh(e)||Lh(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}};class Rh extends Tu{constructor(e,t){super(e,t);const i=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,i&&(this.el_.currentSrc!==i.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const e=this.el_.childNodes;let t=e.length;const i=[];for(;t--;){const r=e[t];"track"===r.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),this.textTracks().addTrack(r.track),s||this.el_.hasAttribute("crossorigin")||!uu(r.src)||(s=!0)):i.push(r))}for(let s=0;s<i.length;s++)this.el_.removeChild(i[s])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s&&ka.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),this.restoreMetadataTracksInIOSNativePlayer_(),(Qa||Ya)&&!0===e.nativeControlsForTouch&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Rh.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Nh(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let i=0;i<e.length;i++){const s=e[i];"metadata"===s.kind&&t.push({track:s,storedMode:s.mode})}};i(),e.addEventListener("change",i),this.on("dispose",(()=>e.removeEventListener("change",i)));const s=()=>{for(let e=0;e<t.length;e++){const i=t[e];"disabled"===i.track.mode&&i.track.mode!==i.storedMode&&(i.track.mode=i.storedMode)}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",(()=>{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)})),this.on("webkitendfullscreen",(()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)}))}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach((e=>{this.el()[`${i}Tracks`].removeEventListener(e,this[`${i}TracksListeners_`][e])})),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=yu[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:t=>{const i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[_u.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},n=function(){const e=[];for(let t=0;t<s.length;t++){let r=!1;for(let e=0;e<i.length;e++)if(i[e]===s[t]){r=!0;break}r||e.push(s[t])}for(;e.length;)s.removeTrack(e.shift())};this[t.getterName+"Listeners_"]=r,Object.keys(r).forEach((e=>{const t=r[e];i.addEventListener(e,t),this.on("dispose",(s=>i.removeEventListener(e,t)))})),this.on("loadstart",n),this.on("dispose",(e=>this.off("loadstart",n)))}proxyNativeTracks_(){yu.names.forEach((e=>{this.proxyNativeTracksForType_(e)}))}createEl(){let e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){const t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),Rh.disposeMediaElement(e),e=t}else{e=S.createElement("video");const t=Oa({},this.options_.tag&&yo(this.options_.tag));Qa&&!0===this.options_.nativeControlsForTouch||delete t.controls,fo(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&bo(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const s=t[i],r=this.options_[s];void 0!==r&&(r?bo(e,s,s):vo(e,s),e[s]=r)}return e}handleLateInit_(e){if(0===e.networkState||3===e.networkState)return;if(0===e.readyState){let e=!1;const t=function(){e=!0};this.on("loadstart",t);const i=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",i),void this.ready((function(){this.off("loadstart",t),this.off("loadedmetadata",i),e||this.trigger("loadstart")}))}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready((function(){t.forEach((function(e){this.trigger(e)}),this)}))}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&eo?this.el_.fastSeek(e):this.el_.currentTime=e}catch(Gf){ka(Gf,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Fa&&Va&&0===this.el_.currentTime){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",(()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)}))}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)$l(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(Gf){this.trigger("fullscreenerror",Gf)}}),0);else try{e.webkitEnterFullScreen()}catch(Gf){this.trigger("fullscreenerror",Gf)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){Rh.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=S.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();const e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),g.performance&&(e.creationTime=g.performance.now()),e}}Na(Rh,"TEST_VID",(function(){if(!ro())return;const e=S.createElement("video"),t=S.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e})),Rh.isSupported=function(){try{Rh.TEST_VID.volume=.5}catch(Gf){return!1}return!(!Rh.TEST_VID||!Rh.TEST_VID.canPlayType)},Rh.canPlayType=function(e){return Rh.TEST_VID.canPlayType(e)},Rh.canPlaySource=function(e,t){return Rh.canPlayType(e.type)},Rh.canControlVolume=function(){try{const e=Rh.TEST_VID.volume;Rh.TEST_VID.volume=e/2+.1;const t=e!==Rh.TEST_VID.volume;return t&&Za?(g.setTimeout((()=>{Rh&&Rh.prototype&&(Rh.prototype.featuresVolumeControl=e!==Rh.TEST_VID.volume)})),!1):t}catch(Gf){return!1}},Rh.canMuteVolume=function(){try{const e=Rh.TEST_VID.muted;return Rh.TEST_VID.muted=!e,Rh.TEST_VID.muted?bo(Rh.TEST_VID,"muted","muted"):vo(Rh.TEST_VID,"muted","muted"),e!==Rh.TEST_VID.muted}catch(Gf){return!1}},Rh.canControlPlaybackRate=function(){if(Fa&&Va&&Wa<58)return!1;try{const e=Rh.TEST_VID.playbackRate;return Rh.TEST_VID.playbackRate=e/2+.1,e!==Rh.TEST_VID.playbackRate}catch(Gf){return!1}},Rh.canOverrideAttributes=function(){try{const e=()=>{};Object.defineProperty(S.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(S.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(S.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(S.createElement("audio"),"innerHTML",{get:e,set:e})}catch(Gf){return!1}return!0},Rh.supportsNativeTextTracks=function(){return eo||Za&&Va},Rh.supportsNativeVideoTracks=function(){return!(!Rh.TEST_VID||!Rh.TEST_VID.videoTracks)},Rh.supportsNativeAudioTracks=function(){return!(!Rh.TEST_VID||!Rh.TEST_VID.audioTracks)},Rh.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function([e,t]){Na(Rh.prototype,e,(()=>Rh[t]()),!0)})),Rh.prototype.featuresVolumeControl=Rh.canControlVolume(),Rh.prototype.movingMediaElementInDOM=!Za,Rh.prototype.featuresFullscreenResize=!0,Rh.prototype.featuresProgressEvents=!0,Rh.prototype.featuresTimeupdateEvents=!0,Rh.prototype.featuresVideoFrameCallback=!(!Rh.TEST_VID||!Rh.TEST_VID.requestVideoFrameCallback),Rh.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(Gf){}}()}},Rh.resetMediaElement=function(e){if(!e)return;const t=e.querySelectorAll("source");let i=t.length;for(;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(Gf){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Rh.prototype["set"+kl(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Rh.prototype["set"+kl(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]()}})),Tu.withSourceHandlers(Rh),Rh.nativeSourceHandler={},Rh.nativeSourceHandler.canPlayType=function(e){try{return Rh.TEST_VID.canPlayType(e)}catch(Gf){return""}},Rh.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Rh.nativeSourceHandler.canPlayType(e.type);if(e.src){const t=lu(e.src);return Rh.nativeSourceHandler.canPlayType(`video/${t}`)}return""},Rh.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Rh.nativeSourceHandler.dispose=function(){},Rh.registerSourceHandler(Rh.nativeSourceHandler),Tu.registerTech("Html5",Rh);const Mh=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Uh={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Bh=["tiny","xsmall","small","medium","large","xlarge","huge"],Fh={};Bh.forEach((e=>{const t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;Fh[e]=`vjs-layout-${t}`}));const jh={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class qh extends Il{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Go()}`,(t=Object.assign(qh.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const i=e.closest("[lang]");i&&(t.language=i.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=Ca(this.id_),this.fsApi_=_a,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&yo(e),this.language(this.options_.language),t.languages){const e={};Object.getOwnPropertyNames(t.languages).forEach((function(i){e[i.toLowerCase()]=t.languages[i]})),this.languages_=e}else this.languages_=qh.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach((e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)})),this.scrubbing_=!1,this.el_=this.createEl(),Tl(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Jo(S,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=Oa(this.options_);t.plugins&&Object.keys(t.plugins).forEach((e=>{this[e](t.plugins[e])})),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),Qa&&this.addClass("vjs-touch-enabled"),Za||this.addClass("vjs-workinghover"),qh.players[this.id_]=this;const r=ca.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(e=>this.listenForUserActivity_(e))),this.on("keydown",(e=>this.handleKeyDown(e))),this.on("languagechange",(e=>this.handleLanguagechange(e))),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",(()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)}))}dispose(){this.trigger("dispose"),this.off("dispose"),Zo(S,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Zo(S,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),qh.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Mu(this),bu.names.forEach((e=>{const t=this[bu[e].getterName]();t&&t.off&&t.off()})),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,i=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div"));const r=yo(t);if(s){for(e=this.el_=t,t=this.tag=S.createElement("video");e.children.length;)t.appendChild(e.firstChild);co(e,"video-js")||po(e,"video-js"),e.appendChild(t),i=this.playerElIngest_=e,Object.keys(e).forEach((i=>{try{t[i]=e[i]}catch(Gf){}}))}if(t.setAttribute("tabindex","-1"),r.tabindex="-1",Va&&Xa&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach((function(i){s&&"class"===i||e.setAttribute(i,r[i]),s&&t.setAttribute(i,r[i])})),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused"),!0!==g.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=qo("vjs-styles-dimensions");const e=Po(".vjs-styles-defaults"),t=Po("head");t.insertBefore(this.styleEl_,e?e.nextSibling:t.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const n=t.getElementsByTagName("a");for(let a=0;a<n.length;a++){const e=n.item(a);po(e,"vjs-hidden"),e.setAttribute("hidden","hidden")}return t.initNetworkState_=t.networkState,t.parentNode&&!i&&t.parentNode.insertBefore(e,t),ho(t,e),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=e,e}crossOrigin(e){if(void 0===e)return this.techGet_("crossOrigin");null===e||"anonymous"===e||"use-credentials"===e?(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)):ka.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();const s=parseFloat(t);isNaN(s)?ka.error(`Improper value "${t}" supplied for for ${e}`):(this[i]=s,this.updateStyleEl_())}fluid(e){if(void 0===e)return!!this.fluid_;this.fluid_=!!e,cl(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),pl(this,(()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)}))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===g.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height,i=this.tech_&&this.tech_.el();return void(i&&(e>=0&&(i.width=e),t>=0&&(i.height=t)))}let e,t,i,s;i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";const r=i.split(":"),n=r[1]/r[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/n:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*n,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),$o(this.styleEl_,`\n .${s} {\n width: ${e}px;\n height: ${t}px;\n }\n\n .${s}.vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ${100*n}%;\n }\n `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=kl(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Tu.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(r=!1);const n={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_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};bu.names.forEach((e=>{const t=bu[e];n[t.getterName]=this[t.privateName]})),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(n.startTime=this.cache_.currentTime);const a=Tu.getTech(e);if(!a)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new a(n),this.tech_.ready(nl(this,this.handleTechReady_),!0),Hl.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Mh.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${kl(e)}_`](t)))})),Object.keys(Uh).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Uh[e]}_`].bind(this),event:t}):this[`handleTech${Uh[e]}_`](t)}))})),this.on(this.tech_,"loadstart",(e=>this.handleTechLoadStart_(e))),this.on(this.tech_,"sourceset",(e=>this.handleTechSourceset_(e))),this.on(this.tech_,"waiting",(e=>this.handleTechWaiting_(e))),this.on(this.tech_,"ended",(e=>this.handleTechEnded_(e))),this.on(this.tech_,"seeking",(e=>this.handleTechSeeking_(e))),this.on(this.tech_,"play",(e=>this.handleTechPlay_(e))),this.on(this.tech_,"pause",(e=>this.handleTechPause_(e))),this.on(this.tech_,"durationchange",(e=>this.handleTechDurationChange_(e))),this.on(this.tech_,"fullscreenchange",((e,t)=>this.handleTechFullscreenChange_(e,t))),this.on(this.tech_,"fullscreenerror",((e,t)=>this.handleTechFullscreenError_(e,t))),this.on(this.tech_,"enterpictureinpicture",(e=>this.handleTechEnterPictureInPicture_(e))),this.on(this.tech_,"leavepictureinpicture",(e=>this.handleTechLeavePictureInPicture_(e))),this.on(this.tech_,"error",(e=>this.handleTechError_(e))),this.on(this.tech_,"posterchange",(e=>this.handleTechPosterChange_(e))),this.on(this.tech_,"textdata",(e=>this.handleTechTextData_(e))),this.on(this.tech_,"ratechange",(e=>this.handleTechRateChange_(e))),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||ho(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){bu.names.forEach((e=>{const t=bu[e];this[t.privateName]=this[t.getterName]()})),this.textTracksJson_=Hl.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 void 0===e&&ka.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}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_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||"string"!=typeof e)return;const t=()=>{const e=this.muted();this.muted(!0);const t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);const i=this.play();if(ql(i))return i.catch((e=>{throw t(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)}))};let i;return"any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():t():(i=this.play(),ql(i)&&(i=i.catch(t))),ql(i)?i.then((()=>{this.trigger({type:"autoplay-success",autoplay:e})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:e})})):void 0}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=qu(this,t)),this.cache_.source=Oa({},e,{src:t,type:i});const s=this.cache_.sources.filter((e=>e.src&&e.src===t)),r=[],n=this.$$("source"),a=[];for(let o=0;o<n.length;o++){const e=yo(n[o]);r.push(e),e.src&&e.src===t&&a.push(e.src)}a.length&&!s.length?this.cache_.sources=r:s.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=e=>this.updateSourceCaches_(e);const i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],(e=>{if("sourceset"===e.type)return;const t=this.techGet("currentSrc");this.lastSource_.tech=t,this.updateSourceCaches_(t)}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((e=>e.callback(e.event))),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?$l(this.play()):this.pause()))}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(t=>t.contains(e.target)))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let s=S[this.fsApi_.fullscreenElement]===i;!s&&i.matches?s=i.matches(":"+this.fsApi_.fullscreen):!s&&i.msMatchesSelector&&(s=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(()=>{this.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready((function(){if(e in Pu)return Au(this.middleware_,this.tech_,e,t);if(e in Ou)return Du(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(Gf){throw ka(Gf),Gf}}),!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in Lu)return Iu(this.middleware_,this.tech_,e);if(e in Ou)return Du(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(Gf){if(void 0===this.tech_[e])throw ka(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,Gf),Gf;if("TypeError"===Gf.name)throw ka(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,Gf),this.tech_.isReady_=!1,Gf;throw ka(Gf),Gf}}}play(){return new Promise((e=>{this.play_(e)}))}play_(e=$l){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(eo||Za);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t)return this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!t&&i&&this.load());const s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===s?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Pl(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}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=Pl(0,0)),e}bufferedPercent(){return Fl(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){const t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise(((i,s)=>{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){r(),i()}function a(e,t){r(),s(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);const o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,s))}))}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){const e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise(((t,i)=>{function s(){e.off("fullscreenerror",n),e.off("fullscreenchange",r)}function r(){s(),t()}function n(e,t){s(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",n);const a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))}))}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=S[this.fsApi_.exitFullscreen]();return e&&$l(e.then((()=>this.isFullscreen(!1)))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=S.documentElement.style.overflow,Jo(S,"keydown",this.boundFullWindowOnEscKey_),S.documentElement.style.overflow="hidden",po(S.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){w.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Zo(S,"keydown",this.boundFullWindowOnEscKey_),S.documentElement.style.overflow=this.docOrigOverflow,mo(S.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&g.documentPictureInPicture){const e=S.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(lo("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),g.documentPictureInPicture.requestWindow({initialAspectRatio:this.videoWidth()/this.videoHeight(),copyStyleSheets:!0}).then((t=>(this.el_.parentNode.insertBefore(e,this.el_),t.document.body.append(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),t.addEventListener("unload",(t=>{const i=t.target.querySelector(".video-js");e.replaceWith(i),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")})),t)))}return"pictureInPictureEnabled"in S&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return g.documentPictureInPicture&&g.documentPictureInPicture.window?(g.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in S?S.exitPictureInPicture():void 0}handleKeyDown(e){const{userActions:t}=this.options_;if(!t||!t.hotkeys)return;(e=>{const t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=(e=>w.isEventKey(e,"f")),muteKey:s=(e=>w.isEventKey(e,"m")),playPauseKey:r=(e=>w.isEventKey(e,"k")||w.isEventKey(e,"Space"))}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const t=Il.getComponent("FullscreenToggle");!1!==S[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else if(s.call(this,e)){e.preventDefault(),e.stopPropagation();Il.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(r.call(this,e)){e.preventDefault(),e.stopPropagation();Il.getComponent("PlayToggle").prototype.handleClick.call(this,e)}}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i<s.length;i++){const r=s[i];let n=Tu.getTech(r);if(n||(n=Il.getComponent(r)),n){if(n.isSupported()&&(t=n.canPlayType(e),t))return t}else ka.error(`The "${r}" tech is undefined. Skipped browser support check for that tech.`)}return""}selectSource(e){const t=this.options_.techOrder.map((e=>[e,Tu.getTech(e)])).filter((([e,t])=>t?t.isSupported():(ka.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1))),i=function(e,t,i){let s;return e.some((e=>t.some((t=>{if(s=i(e,t),s)return!0})))),s};let s;const r=e=>(t,i)=>e(i,t),n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return s=this.options_.sourceOrder?i(e,t,r(n)):i(t,e,n),s||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=$u(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Cu(this,i[0],((e,s)=>{this.middleware_=s,t||(this.cache_.sources=i),this.updateSourceCaches_(e);if(this.src_(e))return i.length>1?this.handleSrc_(i.slice(1)):(this.changingSrc_=!1,this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void this.triggerReady());xu(s,this.tech_)})),i.length>1){const e=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return!t||(Cl(t.tech,this.techName_)?(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready((()=>{this.changingSrc_=!1})),!1))}load(){this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{$l(this.play().then((()=>this.doReset_())))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),cl(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")}loop(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")}poster(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}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(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(void 0===e)return this.error_||null;if(ma("beforeerror").forEach((t=>{const i=t(this,e);La(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){const t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new jl(e),this.addClass("vjs-error"),ka.error(`(CODE:${this.error_.code} ${jl.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),ma("error").forEach((e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const s=nl(this,this.reportUserActivity),r=function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,s())},n=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},a=function(t){s(),this.clearInterval(e)};this.on("mousedown",n),this.on("mousemove",r),this.on("mouseup",a),this.on("mouseleave",a);const o=this.getChild("controlBar");let l;!o||Za||Fa||(o.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),o.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",s),this.on("keyup",s),this.setInterval((function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(l);const e=this.options_.inactivityTimeout;e<=0||(l=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}),250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach((e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((e=>e.show())),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const e=[];return this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then((()=>this.enableAudioOnlyUI_()))}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){if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=e,e){if(this.audioOnlyMode()){return this.audioOnlyMode(!1).then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),cl(this)&&this.trigger("languagechange"))}languages(){return Oa(qh.prototype.options_.languages,this.languages_)}toJSON(){const e=Oa(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let s=t[i];s=Oa(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,t){(t=t||{}).content=e||"";const i=new Gl(this,t);return this.addChild(i),i.on("dispose",(()=>{this.removeChild(i)})),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<Bh.length;i++){const s=Bh[i];if(t<=this.breakpoints_[s]){if(e===s)return;e&&this.removeClass(Fh[e]),this.addClass(Fh[s]),this.breakpoint_=s;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Object.assign({},jh,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){if(void 0===e)return this.responsive_;return(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Fh[this.breakpoint_]||""}loadMedia(e,t){if(!e||"object"!=typeof e)return;this.reset(),this.cache_.media=Oa(e);const{artist:i,artwork:s,description:r,poster:n,src:a,textTracks:o,title:l}=this.cache_.media;!s&&n&&(this.cache_.media.artwork=[{src:n,type:ju(n)}]),a&&this.src(a),n&&this.poster(n),Array.isArray(o)&&o.forEach((e=>this.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:l,description:r||i||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(e=>({kind:e.kind,label:e.label,language:e.language,src:e.src})))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:ju(t.poster)}]),t}return Oa(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=yo(e),s=i["data-setup"];if(co(e,"vjs-fill")&&(i.fill=!0),co(e,"vjs-fluid")&&(i.fluid=!0),null!==s){const[e,t]=C(s||"{}");e&&ka.error(e),Object.assign(i,t)}if(Object.assign(t,i),e.hasChildNodes()){const i=e.childNodes;for(let e=0,s=i.length;e<s;e++){const s=i[e],r=s.nodeName.toLowerCase();"source"===r?t.sources.push(yo(s)):"track"===r&&t.tracks.push(yo(s))}}return t}debug(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((e=>"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}bu.names.forEach((function(e){const t=bu[e];qh.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),qh.prototype.crossorigin=qh.prototype.crossOrigin,qh.players={};const $h=g.navigator;qh.prototype.options_={techOrder:Tu.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:$h&&($h.languages&&$h.languages[0]||$h.userLanguage||$h.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){qh.prototype[e]=function(){return this.techGet_(e)}})),Mh.forEach((function(e){qh.prototype[`handleTech${kl(e)}_`]=function(){return this.trigger(e)}})),Il.registerComponent("Player",qh);const Vh="plugin",Hh="activePlugins_",Wh={},Gh=e=>Wh.hasOwnProperty(e),zh=e=>Gh(e)?Wh[e]:void 0,Xh=(e,t)=>{e[Hh]=e[Hh]||{},e[Hh][t]=!0},Kh=(e,t,i)=>{const s=(i?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},Yh=function(e,t){const i=function(){Kh(this,{name:e,plugin:t,instance:null},!0);const i=t.apply(this,arguments);return Xh(this,e),Kh(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i},Qh=(e,t)=>(t.prototype.name=e,function(...i){Kh(this,{name:e,plugin:t,instance:null},!0);const s=new t(...[this,...i]);return this[e]=()=>s,Kh(this,s.getEventHash()),s});class Jh{constructor(e){if(this.constructor===Jh)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Tl(this),delete this.trigger,El(this,this.constructor.defaultState),Xh(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return el(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Hh][e]=!1,this.player=this.state=null,t[e]=Qh(e,Wh[e])}static isBasic(e){const t="string"==typeof e?zh(e):e;return"function"==typeof t&&!Jh.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Gh(e))ka.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(qh.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Wh[e]=t,e!==Vh&&(Jh.isBasic(t)?qh.prototype[e]=Yh(e,t):qh.prototype[e]=Qh(e,t)),t}static deregisterPlugin(e){if(e===Vh)throw new Error("Cannot de-register base plugin.");Gh(e)&&(delete Wh[e],delete qh.prototype[e])}static getPlugins(e=Object.keys(Wh)){let t;return e.forEach((e=>{const i=zh(e);i&&(t=t||{},t[e]=i)})),t}static getPluginVersion(e){const t=zh(e);return t&&t.VERSION||""}}function Zh(e,t){let i=!1;return function(...s){return i||ka.warn(e),i=!0,t.apply(this,s)}}function ec(e,t,i,s){return Zh(`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s)}Jh.getPlugin=zh,Jh.BASE_PLUGIN_NAME=Vh,Jh.registerPlugin(Vh,Jh),qh.prototype.usingPlugin=function(e){return!!this[Hh]&&!0===this[Hh][e]},qh.prototype.hasPlugin=function(e){return!!Gh(e)};const tc=e=>0===e.indexOf("#")?e.slice(1):e;function ic(e,t,i){let s=ic.getPlayer(e);if(s)return t&&ka.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i),s;const r="string"==typeof e?Po("#"+tc(e)):e;if(!no(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||ka.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),ma("beforesetup").forEach((e=>{const i=e(r,Oa(t));La(i)&&!Array.isArray(i)?t=Oa(t,i):ka.error("please return an object in beforesetup hooks")}));const n=Il.getComponent("Player");return s=new n(r,t,i),ma("setup").forEach((e=>e(s))),s}if(ic.hooks_=pa,ic.hooks=ma,ic.hook=ga,ic.hookOnce=ya,ic.removeHook=fa,!0!==g.VIDEOJS_NO_DYNAMIC_STYLE&&ro()){let Jf=Po(".vjs-styles-defaults");if(!Jf){Jf=qo("vjs-styles-defaults");const Zf=Po("head");Zf&&Zf.insertBefore(Jf,Zf.firstChild),$o(Jf,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}Fo(1,ic),ic.VERSION=ca,ic.options=qh.prototype.options_,ic.getPlayers=()=>qh.players,ic.getPlayer=e=>{const t=qh.players;let i;if("string"==typeof e){const s=tc(e),r=t[s];if(r)return r;i=Po("#"+s)}else i=e;if(no(i)){const{player:e,playerId:s}=i;if(e||t[s])return e||t[s]}},ic.getAllPlayers=()=>Object.keys(qh.players).map((e=>qh.players[e])).filter(Boolean),ic.players=qh.players,ic.getComponent=Il.getComponent,ic.registerComponent=(e,t)=>{Tu.isTech(t)&&ka.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Il.registerComponent.call(Il,e,t)},ic.getTech=Tu.getTech,ic.registerTech=Tu.registerTech,ic.use=ku,Object.defineProperty(ic,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(ic.middleware,"TERMINATOR",{value:wu,writeable:!1,enumerable:!0}),ic.browser=to,ic.obj=Ra,ic.mergeOptions=ec(9,"videojs.mergeOptions","videojs.obj.merge",Oa),ic.defineLazyProperty=ec(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Na),ic.bind=ec(9,"videojs.bind","native Function.prototype.bind",nl),ic.registerPlugin=Jh.registerPlugin,ic.deregisterPlugin=Jh.deregisterPlugin,ic.plugin=(e,t)=>(ka.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Jh.registerPlugin(e,t)),ic.getPlugins=Jh.getPlugins,ic.getPlugin=Jh.getPlugin,ic.getPluginVersion=Jh.getPluginVersion,ic.addLanguage=function(e,t){return e=(""+e).toLowerCase(),ic.options.languages=Oa(ic.options.languages,{[e]:t}),ic.options.languages[e]},ic.log=ka,ic.createLogger=Ca,ic.time=Bl,ic.createTimeRange=ec(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Pl),ic.createTimeRanges=ec(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Pl),ic.formatTime=ec(9,"videojs.formatTime","videojs.time.formatTime",Ul),ic.setFormatTime=ec(9,"videojs.setFormatTime","videojs.time.setFormatTime",Rl),ic.resetFormatTime=ec(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Ml),ic.parseUrl=ec(9,"videojs.parseUrl","videojs.url.parseUrl",au),ic.isCrossOrigin=ec(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",uu),ic.EventTarget=dl,ic.any=il,ic.on=Jo,ic.one=tl,ic.off=Zo,ic.trigger=el,ic.xhr=z,ic.TextTrack=pu,ic.AudioTrack=mu,ic.VideoTrack=gu,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{ic[e]=function(){return ka.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ro[e].apply(null,arguments)}})),ic.computedStyle=ec(9,"videojs.computedStyle","videojs.dom.computedStyle",No),ic.dom=Ro,ic.fn=ll,ic.num=cd,ic.str=xl,ic.url=du;class sc{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class rc extends ic.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new sc(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const i=this[t];if(i.id===e)return i}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}rc.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const ey in rc.prototype.allowedEvents_)rc.prototype["on"+ey]=null;var nc="3.0.0";const ac=ic.registerPlugin||ic.plugin,oc=function(e,t){const i=e.qualityLevels,s=new rc,r=function(){s.dispose(),e.qualityLevels=i,e.off("dispose",r)};return e.on("dispose",r),e.qualityLevels=()=>s,e.qualityLevels.VERSION=nc,s},lc=function(e){return oc(this,ic.mergeOptions({},e))};ac("qualityLevels",lc),lc.VERSION=nc;const uc=Ve,dc=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,hc=e=>ic.log.debug?ic.log.debug.bind(ic,"VHS:",`${e} >`):function(){};function cc(...e){const t=ic.obj||ic;return(t.merge||t.mergeOptions).apply(t,e)}function pc(...e){const t=ic.time||ic;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}const mc=1/30,gc=3*mc,fc=function(e,t){const i=[];let s;if(e&&e.length)for(s=0;s<e.length;s++)t(e.start(s),e.end(s))&&i.push([e.start(s),e.end(s)]);return pc(i)},yc=function(e,t){return fc(e,(function(e,i){return e-gc<=t&&i+gc>=t}))},_c=function(e,t){return fc(e,(function(e){return e-mc>=t}))},bc=function(e){if(e.length<2)return pc();const t=[];for(let i=1;i<e.length;i++){const s=e.end(i-1),r=e.start(i);t.push([s,r])}return pc(t)},vc=function(e,t){let i=null,s=null,r=0;const n=[],a=[];if(!(e&&e.length&&t&&t.length))return pc();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort((function(e,t){return e.time-t.time})),o=0;o<n.length;o++)"start"===n[o].type?(r++,2===r&&(i=n[o].time)):"end"===n[o].type&&(r--,1===r&&(s=n[o].time)),null!==i&&null!==s&&(a.push([i,s]),i=null,s=null);return pc(a)},Tc=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},Sc=function(e,t,i=1){return((e.length?e.end(e.length-1):0)-t)/i},Ec=e=>{const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},wc=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1},kc=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},Cc=function(e,t){let i=0;if(!e||!e.length)return i;for(let s=0;s<e.length;s++){const r=e.start(s),n=e.end(s);t>n||(i+=t>r&&t<=n?n-t:n-r)}return i},xc=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},Ic=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(s,r){e.push({duration:s.duration,segmentIndex:i,partIndex:r,part:s,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),Ac=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},Dc=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:i}=e;let s=(i||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return s+=t&&t.length?t.length:0,s},Lc=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;const i=Ac(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Pc=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if(r=e.segments[s],void 0!==r.end)return{result:i+r.end,precise:!0};if(i+=xc(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},Oc=function(e,t){let i,s=0,r=t-e.mediaSequence;for(;r<e.segments.length;r++){if(i=e.segments[r],void 0!==i.start)return{result:i.start-s,precise:!0};if(s+=xc(e,i),void 0!==i.end)return{result:i.end-s,precise:!0}}return{result:-1,precise:!1}},Nc=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;const s=Pc(e,t);if(s.precise)return s.result;const r=Oc(e,t);return r.precise?r.result:s.result+i},Rc=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return g.Infinity}return Nc(e,t,i)},Mc=function({defaultDuration:e,durationList:t,startIndex:i,endIndex:s}){let r=0;if(i>s&&([i,s]=[s,i]),i<0){for(let t=i;t<Math.min(0,s);t++)r+=e;i=0}for(let n=i;n<s;n++)r+=t[n].duration;return r},Uc=function(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return Rc(e);if(null===t)return null;t=t||0;let r=Nc(e,e.mediaSequence+e.segments.length,t);return i&&(r-=s="number"==typeof s?s:Lc(null,e)),Math.max(0,r)},Bc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Fc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},jc=function(e){const t=Bc(e);return!e.disabled&&!t},qc=function(e,t){return t.attributes&&t.attributes[e]},$c=function(e,t,i,s=0){if(!qc("BANDWIDTH",i))return NaN;return(e*i.attributes.BANDWIDTH-8*s)/t},Vc=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!jc(e)&&(e.attributes.BANDWIDTH||0)<i)).length},Hc=(e,t)=>!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri)))),Wc=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const e in i[r])if(s=t(i[r][e]),s)break;if(s)break}return!!s},Gc=e=>{if(!e||!e.playlists||!e.playlists.length){return Wc(e,(e=>e.playlists&&e.playlists.length||e.uri))}for(let t=0;t<e.playlists.length;t++){const i=e.playlists[t],s=i.attributes&&i.attributes.CODECS;if(s&&s.split(",").every((e=>ct(e))))continue;if(!Wc(e,(e=>Hc(i,e))))return!1}return!0};var zc={liveEdgeDelay:Lc,duration:Rc,seekable:function(e,t,i){const s=t||0,r=Uc(e,t,!0,i);return null===r?pc():pc(s,r)},getMediaInfoForTime:function({playlist:e,currentTime:t,startingSegmentIndex:i,startingPartIndex:s,startTime:r,exactManifestTimings:n}){let a=t-r;const o=Ic(e);let l=0;for(let u=0;u<o.length;u++){const e=o[u];if(i===e.segmentIndex&&("number"!=typeof s||"number"!=typeof e.partIndex||s===e.partIndex)){l=u;break}}if(a<0){if(l>0)for(let t=l-1;t>=0;t--){const i=o[t];if(a+=i.duration,n){if(a<0)continue}else if(a+mc<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r-Mc({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(l<0){for(let i=l;i<0;i++)if(a-=e.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let u=l;u<o.length;u++){const t=o[u];if(a-=t.duration,n){if(a>0)continue}else if(a-mc>=0)continue;return{partIndex:t.partIndex,segmentIndex:t.segmentIndex,startTime:r+Mc({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:u})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:jc,isDisabled:function(e){return e.disabled},isExcluded:Bc,isIncompatible:Fc,playlistEnd:Uc,isAes:function(e){for(let t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:qc,estimateSegmentRequestTime:$c,isLowestEnabledRendition:Vc,isAudioOnly:Gc,playlistMatch:Hc,segmentDurationWithParts:xc};const{log:Xc}=ic,Kc=(e,t)=>`${e}-${t}`,Yc=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,Qc=({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{const a=new st;e&&a.on("warn",e),t&&a.on("info",t),s.forEach((e=>a.addParser(e))),r.forEach((e=>a.addTagMapper(e))),a.push(i),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),e&&e(`manifest has no targetDuration defaulting to ${t}`),o.targetDuration=t}const l=Ac(o);if(l.length&&!o.partTargetDuration){const t=l.reduce(((e,t)=>Math.max(e,t.duration)),0);e&&(e(`manifest has no partTargetDuration defaulting to ${t}`),Xc.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=t}return o},Jc=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const s in e.mediaGroups[i])for(const r in e.mediaGroups[i][s]){const n=e.mediaGroups[i][s][r];t(n,i,s,r)}}))},Zc=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},ep=e=>{let t=e.playlists.length;for(;t--;){const i=e.playlists[t];Zc({playlist:i,id:Kc(t,i.uri)}),i.resolvedUri=uc(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||Xc.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},tp=e=>{Jc(e,(t=>{t.uri&&(t.resolvedUri=uc(e.uri,t.uri))}))},ip=(e,t)=>{const i=Kc(0,t),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:g.location.href,resolvedUri:g.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[t]=s.playlists[0],s},sp=(e,t,i=Yc)=>{e.uri=t;for(let r=0;r<e.playlists.length;r++)if(!e.playlists[r].uri){const t=`placeholder-uri-${r}`;e.playlists[r].uri=t}const s=Gc(e);Jc(e,((t,r,n,a)=>{if(!t.playlists||!t.playlists.length){if(s&&"AUDIO"===r&&!t.uri)for(let t=0;t<e.playlists.length;t++){const i=e.playlists[t];if(i.attributes&&i.attributes.AUDIO&&i.attributes.AUDIO===n)return}t.playlists=[He({},t)]}t.playlists.forEach((function(t,s){const o=i(r,n,a,t),l=Kc(s,o);t.uri?t.resolvedUri=t.resolvedUri||uc(e.uri,t.uri):(t.uri=0===s?o:l,t.resolvedUri=t.uri),t.id=t.id||l,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),ep(e),tp(e)},{EventTarget:rp}=ic,np=(e,t)=>{if(t.endList||!t.serverControl)return e;const i={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let s=t.mediaSequence+t.segments.length;if(e){const r=e.parts||[],n=Dc(t)-1;n>-1&&n!==r.length-1&&(i._HLS_part=n),(n>-1||r.length)&&s--}i._HLS_msn=s}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const t=new g.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])})),e=t.toString()}return e},ap=(e,t)=>{if(!e)return t;const i=cc(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let s=0;s<t.parts.length;s++)e.parts&&e.parts[s]&&(i.parts[s]=cc(e.parts[s],t.parts[s]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},op=(e,t,i)=>{const s=e.slice(),r=t.slice();i=i||0;const n=[];let a;for(let o=0;o<r.length;o++){const e=s[o+i],t=r[o];e?(a=e.map||a,n.push(ap(e,t))):(a&&!t.map&&(t.map=a),n.push(t))}return n},lp=(e,t)=>{!e.resolvedUri&&e.uri&&(e.resolvedUri=uc(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=uc(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=uc(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=uc(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=uc(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=uc(t,e.uri))}))},up=function(e){const t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;e<i.preloadHints.length;e++)if("MAP"===i.preloadHints[e].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t},dp=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,hp=(e,t,i=dp)=>{const s=cc(e,{}),r=s.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=up(t);const n=cc(r,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e<t.skip.skippedSegments;e++)t.segments.unshift({skipped:!0})}n.segments=op(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}n.segments.forEach((e=>{lp(e,n.resolvedUri)}));for(let a=0;a<s.playlists.length;a++)s.playlists[a].id===t.id&&(s.playlists[a]=n);return s.playlists[t.id]=n,s.playlists[t.uri]=n,Jc(e,((e,i,s,r)=>{if(e.playlists)for(let a=0;a<e.playlists.length;a++)t.id===e.playlists[a].id&&(e.playlists[a]=n)})),s},cp=(e,t)=>{const i=e.segments||[],s=i[i.length-1],r=s&&s.parts&&s.parts[s.parts.length-1],n=r&&r.duration||s&&s.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)};class pp extends rp{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=hc("PlaylistLoader");const{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=uc(this.main.uri,e.uri);this.llhls&&(t=np(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,i){const{uri:s,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return Qc({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";const r=t||this.parseManifest_({url:i,manifestString:e});r.lastRequest=Date.now(),Zc({playlist:r,uri:i,id:s});const n=hp(this.main,r);this.targetDuration=r.partTargetDuration||r.targetDuration,this.pendingMedia_=null,n?(this.main=n,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(cp(this.media(),!!n)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),g.clearTimeout(this.mediaUpdateTimeout),g.clearTimeout(this.finalRenditionTimeout),this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(g.clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=g.setTimeout(this.media.bind(this,e,!1),t))}const i=this.state,s=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(s&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(cp(e,!0)),s){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},((t,s)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=dc(e.resolvedUri,s),t)return this.playlistRequestError(this.request,e,i);this.haveMetadata({playlistString:s.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}pause(){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=g.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=g.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=g.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=dc(this.src,t);const i=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(i)}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,sp(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=up(e),e.segments.forEach((t=>{lp(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||g.location.href;this.main=ip(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:mp}=ic,gp=function(e,t,i,s){const r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),s(t,e)},fp=function(){const e=function e(t,i){t=cc({timeout:45e3},t);const s=e.beforeRequest||ic.Vhs.xhr.beforeRequest;if(s&&"function"==typeof s){const e=s(t);e&&(t=e)}const r=(!0===ic.Vhs.xhr.original?mp:ic.Vhs.xhr)(t,(function(e,t){return gp(r,e,t,i)})),n=r.abort;return r.abort=function(){return r.aborted=!0,n.apply(r,arguments)},r.uri=t.uri,r.requestTime=Date.now(),r};return e.original=!0,e},yp=function(e){let t;const i=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?g.BigInt(e.offset)+g.BigInt(e.length)-g.BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t},_p=function(e){const t={};return e.byterange&&(t.Range=yp(e.byterange)),t},bp=function(e,t){return e.start(t)+"-"+e.end(t)},vp=function(e,t){const i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Tp=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Sp=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];wt(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t},Ep=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},wp=function(e){return e.resolvedUri},kp=e=>{const t=Array.prototype.slice.call(e),i=16;let s,r,n="";for(let a=0;a<t.length/i;a++)s=t.slice(a*i,a*i+i).map(vp).join(""),r=t.slice(a*i,a*i+i).map(Tp).join(""),n+=s+" "+r+"\n";return n},Cp=({bytes:e})=>kp(e),xp=e=>{let t,i="";for(t=0;t<e.length;t++)i+=bp(e,t)+" ";return i};var Ip=Object.freeze({__proto__:null,createTransferableMessage:Sp,initSegmentId:Ep,segmentKeyId:wp,hexDump:kp,tagDump:Cp,textRanges:xp});const Ap=.25,Dp=(e,t)=>{if(!t.dateTimeObject)return null;const i=t.videoTimingInfo.transmuxerPrependedSeconds,s=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*s)},Lp=e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,Pp=(e,t)=>{let i;try{i=new Date(e)}catch(Gf){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(i<s.dateTimeObject)return null;for(let o=0;o<t.segments.length-1;o++){s=t.segments[o];if(i<t.segments[o+1].dateTimeObject)break}const r=t.segments[t.segments.length-1],n=r.dateTimeObject,a=r.videoTimingInfo?Lp(r.videoTimingInfo):r.duration+r.duration*Ap;return i>new Date(n.getTime()+1e3*a)?null:(i>n&&(s=r),{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:zc.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"})},Op=(e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,s=0;for(let n=0;n<t.segments.length&&(i=t.segments[n],s=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:s+i.duration,!(e<=s));n++);const r=t.segments[t.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>s){if(e>s+r.duration*Ap)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Np=(e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(Gf){}const r=i.getTime();return(s.getTime()-r)/1e3},Rp=e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t<e.segments.length;t++){if(!e.segments[t].dateTimeObject)return!1}return!0},Mp=({playlist:e,time:t,callback:i})=>{if(!i)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});const s=Op(t,e);if(!s)return i({message:"valid programTime was not found"});if("estimate"===s.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});const r={mediaSeconds:t},n=Dp(t,s.segment);return n&&(r.programDateTime=n.toISOString()),i(null,r)},Up=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!s)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Rp(t))return a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});const o=Pp(e,t);if(!o)return a({message:`${e} was not found in the stream`});const l=o.segment,u=Np(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(s(o.estimatedStart+u),void n.one("seeked",(()=>{Up({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})));const d=l.start+u,h=()=>a(null,n.currentTime());n.one("seeked",h),r&&n.pause(),s(d)},Bp=(e,t)=>{if(4===e.readyState)return t()},Fp=(e,t,i)=>{let s,r=[],n=!1;const a=function(e,t,s,r){return t.abort(),n=!0,i(e,t,s,r)},o=function(e,t){if(n)return;if(e)return a(e,t,"",r);const i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=Pt(r,Lt(i,!0)),s=s||Pn(r),r.length<10||s&&r.length<s+2)return Bp(t,(()=>a(e,t,"",r)));const o=la(r);return"ts"===o&&r.length<188||!o&&r.length<376?Bp(t,(()=>a(e,t,"",r))):a(null,t,o,r)},l={uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:i}){return gp(e,null,{statusCode:e.status},o)}))}},u=t(l,(function(e,t){return gp(u,e,t,o)}));return u},{EventTarget:jp}=ic,qp=function(e,t){if(!dp(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i<e.segments.length;i++){const s=e.segments[i],r=t.segments[i];if(s.uri!==r.uri)return!1;if(!s.byterange&&!r.byterange)continue;const n=s.byterange,a=r.byterange;if(n&&!a||!n&&a)return!1;if(n.offset!==a.offset||n.length!==a.length)return!1}return!0},$p=(e,t,i,s)=>`placeholder-uri-${e}-${t}-${s.attributes.NAME||i}`,Vp=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{const n=kn(e,{manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r});return sp(n,t,$p),n},Hp=(e,t)=>{Jc(e,((i,s,r,n)=>{n in t.mediaGroups[s][r]||delete e.mediaGroups[s][r][n]}))},Wp=(e,t,i)=>{let s=!0,r=cc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let n=0;n<t.playlists.length;n++){const e=t.playlists[n];if(e.sidx){const t=Lr(e.sidx);i&&i[t]&&i[t].sidx&&Sr(e,i[t].sidx,e.sidx.resolvedUri)}const a=hp(r,e,qp);a&&(r=a,s=!1)}return Jc(t,((e,t,i,n)=>{if(e.playlists&&e.playlists.length){const a=e.playlists[0].id,o=hp(r,e.playlists[0],qp);o&&(r=o,n in r.mediaGroups[t][i]||(r.mediaGroups[t][i][n]=e),r.mediaGroups[t][i][n].playlists[0]=r.playlists[a],s=!1)}})),Hp(r,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(s=!1),s?null:r},Gp=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,zp=(e,t)=>{const i={};for(const s in e){const r=e[s].sidx;if(r){const e=Lr(r);if(!t[e])break;const s=t[e].sidxInfo;Gp(s,r)&&(i[e]=t[e])}}return i},Xp=(e,t)=>{let i=zp(e.playlists,t);return Jc(e,((e,s,r,n)=>{if(e.playlists&&e.playlists.length){const s=e.playlists;i=cc(i,zp(s,t))}})),i};class Kp extends jp{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,!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_=hc("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){const s=e.sidx&&Lr(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s])return void(this.mediaRequest_=g.setTimeout((()=>i(!1)),0));const r=dc(e.sidx.resolvedUri),n=(r,n)=>{if(this.requestErrored_(r,n,t))return;const a=this.mainPlaylistLoader_.sidxMapping_;let o;try{o=An(Ct(n.response).subarray(8))}catch(Gf){return void this.requestErrored_(Gf,n,t)}return a[s]={sidxInfo:e.sidx,sidx:o},Sr(e,o,e.sidx.resolvedUri),i(!0)};this.request=Fp(r,this.vhs_.xhr,((t,i,s,a)=>{if(t)return n(t,i);if(!s||"mp4"!==s)return n({status:i.status,message:`Unsupported ${s||"unknown"} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);const{offset:o,length:l}=e.sidx.byterange;if(a.length>=l+o)return n(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",headers:_p({byterange:e.sidx.byterange})},n)}))}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},g.clearTimeout(this.minimumUpdatePeriodTimeout_),g.clearTimeout(this.mediaRequest_),g.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("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(i=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(g.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=g.setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=g.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,i)=>{if(this.requestErrored_(t,i))return void("HAVE_NOTHING"===this.state&&(this.started=!1));const s=i.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=dc(this.mainPlaylistLoader_.srcUrl,i),s?(this.handleMain_(),void this.syncClientServerClock_((()=>e(i,s)))):e(i,s)}))}syncClientServerClock_(e){const t=Cn(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:uc(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((i,s)=>{if(!this.request)return;if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let r;r="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let t=Vp({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=Wp(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(g.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=g.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=Xp(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=g.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),cp(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}}var Yp={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 Qp=e=>{const t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer},Jp=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Zp=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(Gf){const i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}},em=function(e){return function(){const t=Zp(e),i=Jp(new Worker(t));i.objURL=t;const s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),s.call(this)},i}},tm=function(e){return`var browserWorkerPolyFill = ${Jp.toString()};\nbrowserWorkerPolyFill(self);\n`+e},im=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},sm=tm(im((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var s;return!!e[t]&&(s=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(s,1),s>-1)},this.trigger=function(t){var i,s,r,n;if(i=e[t])if(2===arguments.length)for(r=i.length,s=0;s<r;++s)i[s].call(this,arguments[1]);else{for(n=[],s=arguments.length,s=1;s<arguments.length;++s)n.push(arguments[s]);for(r=i.length,s=0;s<r;++s)i[s].apply(this,n)}},this.dispose=function(){e={}}}};t.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},t.prototype.push=function(e){this.trigger("data",e)},t.prototype.flush=function(e){this.trigger("done",e)},t.prototype.partialFlush=function(e){this.trigger("partialdone",e)},t.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},t.prototype.reset=function(e){this.trigger("reset",e)};var i,s,r,n,a,o,l,u,d,h,c,p,m,g,f,y,_,b,v,T,S,E,w,k,C,x,I,A,D,L,P,O,N,R,M,U,B,F,j,q,$=t,V=Math.pow(2,32),H={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*V+i.getUint32(4)},MAX_UINT32:V},W=H.MAX_UINT32;!function(){var e;if(E={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in E)E.hasOwnProperty(e)&&(E[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),C=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),k=new Uint8Array([0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),I=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:x,audio:I},P=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),O=new Uint8Array([0,0,0,0,0,0,0,0]),N=O,R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=O,D=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),i=function(e){var t,i,s=[],r=0;for(t=1;t<arguments.length;t++)s.push(arguments[t]);for(t=s.length;t--;)r+=s[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<s.length;t++)i.set(s[t],r),r+=s[t].byteLength;return i},s=function(){return i(E.dinf,i(E.dref,P))},r=function(e){return i(E.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},f=function(e){return i(E.hdlr,A[e])},g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),i(E.mdhd,t)},m=function(e){return i(E.mdia,g(e),f(e.type),o(e))},a=function(e){return i(E.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return i(E.minf,"video"===e.type?i(E.vmhd,D):i(E.smhd,L),s(),_(e))},l=function(e,t){for(var s=[],r=t.length;r--;)s[r]=v(t[r]);return i.apply(null,[E.moof,a(e)].concat(s))},u=function(e){for(var t=e.length,s=[];t--;)s[t]=c(e[t]);return i.apply(null,[E.moov,h(4294967295)].concat(s).concat(d(e)))},d=function(e){for(var t=e.length,s=[];t--;)s[t]=T(e[t]);return i.apply(null,[E.mvex].concat(s))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(E.mvhd,t)},y=function(e){var t,s,r=e.samples||[],n=new Uint8Array(4+r.length);for(s=0;s<r.length;s++)t=r[s].flags,n[s+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return i(E.sdtp,n)},_=function(e){return i(E.stbl,b(e),i(E.stts,M),i(E.stsc,N),i(E.stsz,R),i(E.stco,O))},b=function(e){return i(E.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?U(e):B(e))},U=function(e){var t,s,r=e.sps||[],n=e.pps||[],a=[],o=[];for(t=0;t<r.length;t++)a.push((65280&r[t].byteLength)>>>8),a.push(255&r[t].byteLength),a=a.concat(Array.prototype.slice.call(r[t]));for(t=0;t<n.length;t++)o.push((65280&n[t].byteLength)>>>8),o.push(255&n[t].byteLength),o=o.concat(Array.prototype.slice.call(n[t]));if(s=[E.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(E.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[n.length],o))),i(E.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];s.push(i(E.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return i.apply(null,s)},B=function(e){return i(E.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return i(E.tkhd,t)},v=function(e){var t,s,r,n,a,o,l;return t=i(E.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(e.baseMediaDecodeTime/W),l=Math.floor(e.baseMediaDecodeTime%W),s=i(E.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l])),a=92,"audio"===e.type?(r=S(e,a),i(E.traf,t,s,r)):(n=y(e),r=S(e,n.length+a),i(E.traf,t,s,r,n))},c=function(e){return e.duration=e.duration||4294967295,i(E.trak,p(e),m(e))},T=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),i(E.trex,t)},q=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(n=8)),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},j=function(e,t){var s,r,n,a,o,l;for(t+=20+16*(a=e.samples||[]).length,n=q(a,t),(r=new Uint8Array(n.length+16*a.length)).set(n),s=n.length,l=0;l<a.length;l++)o=a[l],r[s++]=(4278190080&o.duration)>>>24,r[s++]=(16711680&o.duration)>>>16,r[s++]=(65280&o.duration)>>>8,r[s++]=255&o.duration,r[s++]=(4278190080&o.size)>>>24,r[s++]=(16711680&o.size)>>>16,r[s++]=(65280&o.size)>>>8,r[s++]=255&o.size,r[s++]=o.flags.isLeading<<2|o.flags.dependsOn,r[s++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[s++]=61440&o.flags.degradationPriority,r[s++]=15&o.flags.degradationPriority,r[s++]=(4278190080&o.compositionTimeOffset)>>>24,r[s++]=(16711680&o.compositionTimeOffset)>>>16,r[s++]=(65280&o.compositionTimeOffset)>>>8,r[s++]=255&o.compositionTimeOffset;return i(E.trun,r)},F=function(e,t){var s,r,n,a,o,l;for(t+=20+8*(a=e.samples||[]).length,n=q(a,t),(s=new Uint8Array(n.length+8*a.length)).set(n),r=n.length,l=0;l<a.length;l++)o=a[l],s[r++]=(4278190080&o.duration)>>>24,s[r++]=(16711680&o.duration)>>>16,s[r++]=(65280&o.duration)>>>8,s[r++]=255&o.duration,s[r++]=(4278190080&o.size)>>>24,s[r++]=(16711680&o.size)>>>16,s[r++]=(65280&o.size)>>>8,s[r++]=255&o.size;return i(E.trun,s)},S=function(e,t){return"audio"===e.type?F(e,t):j(e,t)};var G,z,X,K,Y,Q,J,Z,ee={ftyp:n=function(){return i(E.ftyp,w,k,w,C)},mdat:function(e){return i(E.mdat,e)},moof:l,moov:u,initSegment:function(e){var t,i=n(),s=u(e);return(t=new Uint8Array(i.byteLength+s.byteLength)).set(i),t.set(s,i.byteLength),t}},te=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ie=function(e,t){var i=te();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},se={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,s.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(s.length&&(s.duration=i.dts-s.dts,r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s)),(s=[i]).byteLength=i.data.byteLength,s.pts=i.pts,s.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(s.keyFrame=!0),s.duration=i.dts-s.dts,s.byteLength+=i.data.byteLength,s.push(i));return r.length&&(!s.duration||s.duration<=0)&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s),r},groupFramesIntoGops:function(e){var t,i,s=[],r=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,s.pts=e[0].pts,s.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(s.length&&(r.push(s),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration),(s=[i]).nalCount=i.length,s.byteLength=i.byteLength,s.pts=i.pts,s.dts=i.dts,s.duration=i.duration):(s.duration+=i.duration,s.nalCount+=i.length,s.byteLength+=i.byteLength,s.push(i));return r.length&&s.duration<=0&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration,r.push(s),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,s,r,n,a,o=t||0,l=[];for(i=0;i<e.length;i++)for(n=e[i],s=0;s<n.length;s++)a=n[s],o+=(r=ie(a,o)).size,l.push(r);return l},concatenateNalData:function(e){var t,i,s,r,n,a,o=0,l=e.byteLength,u=e.nalCount,d=new Uint8Array(l+4*u),h=new DataView(d.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(n=r[i],s=0;s<n.length;s++)a=n[s],h.setUint32(o,a.data.byteLength),o+=4,d.set(a.data,o),o+=a.data.byteLength;return d},generateSampleTableForFrame:function(e,t){var i,s=[];return i=ie(e,t||0),s.push(i),s},concatenateNalDataForFrame:function(e){var t,i,s=0,r=e.byteLength,n=e.length,a=new Uint8Array(r+4*n),o=new DataView(a.buffer);for(t=0;t<e.length;t++)i=e[t],o.setUint32(s,i.data.byteLength),s+=4,a.set(i.data,s),s+=i.data.byteLength;return a}},re=[33,16,5,32,164,27],ne=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ae=function(e){for(var t=[];e--;)t.push(0);return t},oe=function(e){return Object.keys(e).reduce((function(t,i){return t[i]=new Uint8Array(e[i].reduce((function(e,t){return e.concat(t)}),[])),t}),{})},le=function(){if(!G){var e={96e3:[re,[227,64],ae(154),[56]],88200:[re,[231],ae(170),[56]],64e3:[re,[248,192],ae(240),[56]],48e3:[re,[255,192],ae(268),[55,148,128],ae(54),[112]],44100:[re,[255,192],ae(268),[55,163,128],ae(84),[112]],32e3:[re,[255,192],ae(268),[55,234],ae(226),[112]],24e3:[re,[255,192],ae(268),[55,255,128],ae(268),[111,112],ae(126),[224]],16e3:[re,[255,192],ae(268),[55,255,128],ae(268),[111,255],ae(269),[223,108],ae(195),[1,192]],12e3:[ne,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,253,128],ae(259),[56]],11025:[ne,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,255,192],ae(268),[55,175,128],ae(108),[112]],8e3:[ne,ae(268),[3,121,16],ae(47),[7]]};G=oe(e)}return G},ue=9e4;Q=function(e,t){return z(Y(e,t))},J=function(e,t){return X(K(e),t)},Z=function(e,t,i){return K(i?e:e-t)};var de={ONE_SECOND_IN_TS:ue,secondsToVideoTs:z=function(e){return e*ue},secondsToAudioTs:X=function(e,t){return e*t},videoTsToSeconds:K=function(e){return e/ue},audioTsToSeconds:Y=function(e,t){return e/t},audioTsToVideoTs:Q,videoTsToAudioTs:J,metadataTsToSeconds:Z},he=le,ce=de,pe=function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i},me={prefixWithSilence:function(e,t,i,s){var r,n,a,o,l=0,u=0,d=0,h=0;if(t.length&&(r=ce.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),l=Math.ceil(ce.ONE_SECOND_IN_TS/(e.samplerate/1024)),i&&s&&(u=r-Math.max(i,s),h=(d=Math.floor(u/l))*l),!(d<1||h>ce.ONE_SECOND_IN_TS/2))){for((n=he()[e.samplerate])||(n=t[0].data),a=0;a<d;a++)o=t[0],t.splice(0,0,{data:n,dts:o.dts-l,pts:o.pts-l});return e.baseMediaDecodeTime-=Math.floor(ce.videoTsToAudioTs(h,e.samplerate)),h}},trimAdtsFramesByEarliestDts:function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},generateSampleTable:function(e){var t,i,s=[];for(t=0;t<e.length;t++)i=e[t],s.push({size:i.data.byteLength,duration:1024});return s},concatenateFrameData:function(e){var t,i,s=0,r=new Uint8Array(pe(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,s),s+=i.data.byteLength;return r}},ge=de.ONE_SECOND_IN_TS,fe={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var i,s=e.minSegmentDts;return t||(s-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=s,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/ge,i=Math.floor(i)),i},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},ye=4,_e=128,be={parseSei:function(e){for(var t=0,i={payloadType:-1,payloadSize:0},s=0,r=0;t<e.byteLength&&e[t]!==_e;){for(;255===e[t];)s+=255,t++;for(s+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&s===ye){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=s,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,s=0,r=0}return i},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var i,s,r,n,a=[];if(!(64&t[0]))return a;for(s=31&t[0],i=0;i<s;i++)n={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(n.ccData=t[r+3]<<8|t[r+4],a.push(n));return a},discardEmulationPreventionBytes:function(e){for(var t,i,s=e.byteLength,r=[],n=1;n<s-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;t=s-r.length,i=new Uint8Array(t);var a=0;for(n=0;n<t;a++,n++)a===r[0]&&(a++,r.shift()),i[n]=e[a];return i},USER_DATA_REGISTERED_ITU_T_T35:ye},ve=$,Te=be,Se=function(e){e=e||{},Se.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Ne(0,0),new Ne(0,1),new Ne(1,0),new Ne(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ie({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Se.prototype=new ve,Se.prototype.push=function(e){var t,i,s;if("sei_rbsp"===e.nalUnitType&&(t=Te.parseSei(e.escapedRBSP)).payload&&t.payloadType===Te.USER_DATA_REGISTERED_ITU_T_T35&&(i=Te.parseUserData(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));s=Te.parseCaptionPackets(e.pts,i),this.captionPackets_=this.captionPackets_.concat(s),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Se.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Se.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Se.prototype.flush=function(){return this.flushStream("flush")},Se.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Se.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Se.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Se.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Se.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Se.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Se.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Ee={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},we=function(e){var t=Ee[e]||e;return 4096&e&&e===t?"":String.fromCharCode(t)},ke=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Ce=function(e){this.windowNum=e,this.reset()};Ce.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Ce.prototype.getText=function(){return this.rows.join("\n")},Ce.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ce.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Ce.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Ce.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Ce.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var xe=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Ce(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};xe.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Ce(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},xe.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},xe.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ie=function(e){e=e||{},Ie.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach((e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(i.new708Packet(),i.add708Bytes(e)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e))}};Ie.prototype=new ve,Ie.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ie.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,s=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},Ie.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,s=null,r=0,n=t[r++];for(e.seq=n>>6,e.sizeCode=63&n;r<t.length;r++)s=31&(n=t[r++]),7===(i=n>>5)&&s>0&&(i=n=t[r++]),this.pushServiceBlock(i,r,s),s>0&&(r+=s-1)},Ie.prototype.pushServiceBlock=function(e,t,i){var s,r=t,n=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,r));r<t+i&&r<n.length;r++)s=n[r],ke(s)?r=this.handleText(r,a):24===s?r=this.multiByteCharacter(r,a):16===s?r=this.extendedCommands(r,a):128<=s&&s<=135?r=this.setCurrentWindow(r,a):152<=s&&s<=159?r=this.defineWindow(r,a):136===s?r=this.clearWindows(r,a):140===s?r=this.deleteWindows(r,a):137===s?r=this.displayWindows(r,a):138===s?r=this.hideWindows(r,a):139===s?r=this.toggleWindows(r,a):151===s?r=this.setWindowAttributes(r,a):144===s?r=this.setPenAttributes(r,a):145===s?r=this.setPenColor(r,a):146===s?r=this.setPenLocation(r,a):143===s?a=this.reset(r,a):8===s?a.currentWindow.backspace():12===s?a.currentWindow.clearText():13===s?a.currentWindow.pendingNewLine=!0:14===s?a.currentWindow.clearText():141===s&&r++},Ie.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return ke(i)&&(e=this.handleText(e,t,{isExtended:!0})),e},Ie.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ie.prototype.initService=function(e,t){var i,s,r=this;return(i="SERVICE"+e)in this.serviceEncodings&&(s=this.serviceEncodings[i]),this.services[e]=new xe(e,s,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},Ie.prototype.handleText=function(e,t,i){var s,r,n=i&&i.isExtended,a=i&&i.isMultiByte,o=this.current708Packet.data,l=n?4096:0,u=o[e],d=o[e+1],h=t.currentWindow;return t.textDecoder_&&!n?(a?(r=[u,d],e++):r=[u],s=t.textDecoder_.decode(new Uint8Array(r))):s=we(l|u),h.pendingNewLine&&!h.isEmpty()&&h.newLine(this.getPts(e)),h.pendingNewLine=!1,h.addText(s),e},Ie.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],r=i[e+2];return ke(s)&&ke(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Ie.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Ie.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],r=7&s;t.setCurrentWindow(r);var n=t.currentWindow;return s=i[++e],n.visible=(32&s)>>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++e],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++e],n.anchorHorizontal=s,s=i[++e],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++e],n.columnCount=63&s,s=i[++e],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,e},Ie.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.winAttr;return s=i[++e],r.fillOpacity=(192&s)>>6,r.fillRed=(48&s)>>4,r.fillGreen=(12&s)>>2,r.fillBlue=3&s,s=i[++e],r.borderType=(192&s)>>6,r.borderRed=(48&s)>>4,r.borderGreen=(12&s)>>2,r.borderBlue=3&s,s=i[++e],r.borderType+=(128&s)>>5,r.wordWrap=(64&s)>>6,r.printDirection=(48&s)>>4,r.scrollDirection=(12&s)>>2,r.justify=3&s,s=i[++e],r.effectSpeed=(240&s)>>4,r.effectDirection=(12&s)>>2,r.displayEffect=3&s,e},Ie.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Ie.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ie.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Ie.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Ie.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Ie.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Ie.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Ie.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penAttr;return s=i[++e],r.textTag=(240&s)>>4,r.offset=(12&s)>>2,r.penSize=3&s,s=i[++e],r.italics=(128&s)>>7,r.underline=(64&s)>>6,r.edgeType=(56&s)>>3,r.fontStyle=7&s,e},Ie.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penColor;return s=i[++e],r.fgOpacity=(192&s)>>6,r.fgRed=(48&s)>>4,r.fgGreen=(12&s)>>2,r.fgBlue=3&s,s=i[++e],r.bgOpacity=(192&s)>>6,r.bgRed=(48&s)>>4,r.bgGreen=(12&s)>>2,r.bgBlue=3&s,s=i[++e],r.edgeRed=(48&s)>>4,r.edgeGreen=(12&s)>>2,r.edgeBlue=3&s,e},Ie.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,s=i[++e],r.row=15&s,s=i[++e],r.column=63&s,e},Ie.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Ae={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},De=function(e){return null===e?"":(e=Ae[e]||e,String.fromCharCode(e))},Le=14,Pe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oe=function(){for(var e=[],t=Le+1;t--;)e.push("");return e},Ne=function(e,t){Ne.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),s=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Oe();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Oe();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Oe()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(s,r))n=De((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isExtCharacter(s,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),n=De((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isMidRowCode(s,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(s,r))this.column_+=3&r;else if(this.isPAC(s,r)){var a=Pe.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(s)&&(0===r&&(r=null),n=De(s),n+=De(r),this[this.mode_](e.pts,n),this.column_+=n.length)}else this.lastControlCode_=null}};Ne.prototype=new ve,Ne.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(Gf){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ne.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Oe(),this.nonDisplayed_=Oe(),this.lastControlCode_=null,this.column_=0,this.row_=Le,this.rollUpRows_=2,this.formatting_=[]},Ne.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ne.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ne.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ne.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ne.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ne.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Ne.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ne.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ne.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=Le,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Oe(),this.displayed_=Oe()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Ne.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},Ne.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},Ne.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ne.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ne.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<Le+1;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Ne.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Re={CaptionStream:Se,Cea608Stream:Ne,Cea708Stream:Ie},Me={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ue=$,Be=8589934592,Fe=4294967296,je="shared",qe=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>Fe;)e+=i*Be;return e},$e=function(e){var t,i;$e.prototype.init.call(this),this.type_=e||je,this.push=function(e){this.type_!==je&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=qe(e.dts,i),e.pts=qe(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};$e.prototype=new Ue;var Ve,He={TimestampRolloverStream:$e,handleRollover:qe},We=(e,t,i)=>{if(!e)return-1;for(var s=i;s<e.length;s++)if(e[s]===t)return s;return-1},Ge={typedArrayIndexOf:We}.typedArrayIndexOf,ze={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Xe=function(e,t,i){var s,r="";for(s=t;s<i;s++)r+="%"+("00"+e[s].toString(16)).slice(-2);return r},Ke=function(e,t,i){return decodeURIComponent(Xe(e,t,i))},Ye=function(e,t,i){return unescape(Xe(e,t,i))},Qe=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Je={APIC:function(e){var t,i,s=1,r="--\x3e";e.data[0]===ze.Utf8&&((t=Ge(e.data,0,s))<0||(e.mimeType=Ye(e.data,s,t),s=t+1,e.pictureType=e.data[s],s++,(i=Ge(e.data,0,s))<0||(e.description=Ke(e.data,s,i),s=i+1,e.mimeType===r?e.url=Ye(e.data,s,e.data.length):e.pictureData=e.data.subarray(s,e.data.length))))},"T*":function(e){e.data[0]===ze.Utf8&&(e.value=Ke(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===ze.Utf8&&-1!==(t=Ge(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.value=Ke(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=Ye(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===ze.Utf8&&-1!==(t=Ge(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.url=Ye(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=Ye(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},Ze={parseId3Frames:function(e){var t,i=10,s=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){s=Qe(e.subarray(6,10)),s+=10,64&e[5]&&(i+=4,i+=Qe(e.subarray(10,14)),s-=Qe(e.subarray(16,20)));do{if((t=Qe(e.subarray(i+4,i+8)))<1)break;var n={id:String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]),data:e.subarray(i+10,i+t+10)};n.key=n.id,Je[n.id]?Je[n.id](n):"T"===n.id[0]?Je["T*"](n):"W"===n.id[0]&&Je["W*"](n),r.push(n),i+=10,i+=t}while(i<s);return r}},parseSyncSafeInteger:Qe,frameParsers:Je},et=Me,tt=Ze;(Ve=function(e){var t,i={descriptor:e&&e.descriptor},s=0,r=[],n=0;if(Ve.prototype.init.call(this),this.dispatchType=et.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,a,o,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(n=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),n+=e.data.byteLength,1===r.length&&(s=tt.parseSyncSafeInteger(e.data.subarray(6,10)),s+=10),!(n<s)){for(t={data:new Uint8Array(s),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<s;)t.data.set(r[0].data.subarray(0,s-l),l),l+=r[0].data.byteLength,n-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=tt.parseSyncSafeInteger(t.data.subarray(10,14)),s-=tt.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((a=tt.parseSyncSafeInteger(t.data.subarray(i+4,i+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if((o={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+a+10)}).key=o.id,tt.frameParsers[o.id]?tt.frameParsers[o.id](o):"T"===o.id[0]?tt.frameParsers["T*"](o):"W"===o.id[0]&&tt.frameParsers["W*"](o),"com.apple.streaming.transportStreamTimestamp"===o.owner){var u=o.data,d=(1&u[3])<<30|u[4]<<22|u[5]<<14|u[6]<<6|u[7]>>>2;d*=4,d+=3&u[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=a}while(i<s);this.trigger("data",t)}}}).prototype=new $;var it,st,rt,nt=Ve,at=$,ot=Re,lt=Me,ut=He.TimestampRolloverStream,dt=188,ht=71;(it=function(){var e=new Uint8Array(dt),t=0;it.prototype.init.call(this),this.push=function(i){var s,r=0,n=dt;for(t?((s=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),s.set(i,t),t=0):s=i;n<s.byteLength;)s[r]!==ht||s[n]!==ht?(r++,n++):(this.trigger("data",s.subarray(r,n)),r+=dt,n+=dt);r<s.byteLength&&(e.set(s.subarray(r),0),t=s.byteLength-r)},this.flush=function(){t===dt&&e[0]===ht&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new at,st=function(){var e,t,i,s;st.prototype.init.call(this),s=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,s){var r=0;s.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===s.type?t(e.subarray(r),s):i(e.subarray(r),s)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],s.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=s.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var n=e[r],a=(31&e[r+1])<<8|e[r+2];n===lt.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=a:n===lt.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=a:n===lt.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][a]=n),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=s.programMapTable}},this.push=function(t){var i={},s=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(s+=t[s]+1),0===i.pid)i.type="pat",e(t.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,s,i]):this.processPes_(t,s,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=lt.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=lt.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},st.prototype=new at,st.STREAM_TYPES={h264:27,adts:15},rt=function(){var e,t=this,i=!1,s={data:[],size:0},r={data:[],size:0},n={data:[],size:0},a=function(e,t){var i;const s=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===s&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))},o=function(e,i,s){var r,n=new Uint8Array(e.size),o={type:i},l=0,u=0,d=!1;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,l=0;l<e.data.length;l++)r=e.data[l],n.set(r.data,u),u+=r.data.byteLength;a(n,o),d="video"===i||o.packetLength<=e.size,(s||d)&&(e.size=0,e.data.length=0),d&&t.trigger("data",o)}};rt.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,t;switch(a.streamType){case lt.H264_STREAM_TYPE:e=s,t="video";break;case lt.ADTS_STREAM_TYPE:e=r,t="audio";break;case lt.METADATA_STREAM_TYPE:e=n,t="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&o(e,t,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(e=a.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",s)}})[a.type]()},this.reset=function(){s.size=0,s.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){o(s,"video"),o(r,"audio"),o(n,"timed-metadata")},this.flush=function(){if(!i&&e){var s={type:"metadata",tracks:[]};null!==e.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}},rt.prototype=new at;var ct={PAT_PID:0,MP2T_PACKET_LENGTH:dt,TransportPacketStream:it,TransportParseStream:st,ElementaryStream:rt,TimestampRolloverStream:ut,CaptionStream:ot.CaptionStream,Cea608Stream:ot.Cea608Stream,Cea708Stream:ot.Cea708Stream,MetadataStream:nt};for(var pt in lt)lt.hasOwnProperty(pt)&&(ct[pt]=lt[pt]);var mt,gt=ct,ft=$,yt=de.ONE_SECOND_IN_TS,_t=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(mt=function(e){var t,i=0;mt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${i} outside syncword`})},this.push=function(s){var r,n,a,o,l,u=0;if(e||(i=0),"audio"===s.type){var d;for(t&&t.length?(a=t,(t=new Uint8Array(a.byteLength+s.data.byteLength)).set(a),t.set(s.data,a.byteLength)):t=s.data;u+7<t.length;)if(255===t[u]&&240==(246&t[u+1])){if("number"==typeof d&&(this.skipWarn_(d,u),d=null),n=2*(1&~t[u+1]),r=(3&t[u+3])<<11|t[u+4]<<3|(224&t[u+5])>>5,l=(o=1024*(1+(3&t[u+6])))*yt/_t[(60&t[u+2])>>>2],t.byteLength-u<r)break;this.trigger("data",{pts:s.pts+i*l,dts:s.dts+i*l,sampleCount:o,audioobjecttype:1+(t[u+2]>>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:_t[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+n,u+r)}),i++,u+=r}else"number"!=typeof d&&(d=u),u++;"number"==typeof d&&(this.skipWarn_(d,u),d=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new ft;var bt,vt=mt;bt=function(e){var t=e.byteLength,i=0,s=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+s},this.loadWord=function(){var r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");n.set(e.subarray(r,r+a)),i=new DataView(n.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var r;s>e?(i<<=e,s-=e):(e-=s,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,s-=e)},this.readBits=function(e){var r=Math.min(s,e),n=i>>>32-r;return(s-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?n<<r|this.readBits(r):n},this.skipLeadingZeros=function(){var e;for(e=0;e<s;++e)if(0!=(i&2147483648>>>e))return i<<=e,s-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Tt,St,Et,wt=$,kt=bt;(St=function(){var e,t,i=0;St.prototype.init.call(this),this.push=function(s){var r;t?((r=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),r.set(s.data,t.byteLength),t=r):t=s.data;for(var n=t.byteLength;i<n-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<n;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<n);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new wt,Et={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Tt=function(){var e,t,i,s,r,n,a,o=new St;Tt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,o.push(e))},o.on("data",(function(a){var o={trackId:t,pts:i,dts:s,data:a,nalUnitTypeCode:31&a[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,s=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(s+t.readExpGolomb()+256)%256),s=0===r?s:r},r=function(e){for(var t,i,s=e.byteLength,r=[],n=1;n<s-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;t=s-r.length,i=new Uint8Array(t);var a=0;for(n=0;n<t;a++,n++)a===r[0]&&(a++,r.shift()),i[n]=e[a];return i},n=function(e){var t,i,s,r,n,o,l,u,d,h,c,p,m=0,g=0,f=0,y=0,_=[1,1];if(i=(t=new kt(e)).readUnsignedByte(),r=t.readUnsignedByte(),s=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Et[i]&&(3===(n=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(c=3!==n?8:12,p=0;p<c;p++)t.readBoolean()&&a(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),l=t.readUnsignedExpGolomb(),p=0;p<l;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),u=t.readUnsignedExpGolomb(),d=t.readUnsignedExpGolomb(),0===(h=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),f=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}_&&(_[0],_[1])}return{profileIdc:i,levelIdc:s,profileCompatibility:r,width:16*(u+1)-2*m-2*g,height:(2-h)*(d+1)*16-2*f-2*y,sarRatio:_}}},Tt.prototype=new wt;var Ct,xt={H264Stream:Tt,NalByteStream:St},It=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],At=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=i>=0?i:0,(16&e[t+5])>>4?i+20:i+10},Dt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=At(e,t),Dt(e,t))},Lt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Pt=function(e,t,i){var s,r="";for(s=t;s<i;s++)r+="%"+("00"+e[s].toString(16)).slice(-2);return r},Ot=function(e,t,i){return unescape(Pt(e,t,i))},Nt={isLikelyAacData:function(e){var t=Dt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:At,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return It[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,s;t=10,64&e[5]&&(t+=4,t+=Lt(e.subarray(10,14)));do{if((i=Lt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){s=e.subarray(t+10,t+i+10);for(var r=0;r<s.byteLength;r++)if(0===s[r]){if("com.apple.streaming.transportStreamTimestamp"===Ot(s,0,r)){var n=s.subarray(r+1),a=(1&n[3])<<30|n[4]<<22|n[5]<<14|n[6]<<6|n[7]>>>2;return a*=4,a+=3&n[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}},Rt=Nt;(Ct=function(){var e=new Uint8Array,t=0;Ct.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var s,r,n,a,o=0,l=0;for(e.length?(a=e.length,(e=new Uint8Array(i.byteLength+a)).set(e.subarray(0,a)),e.set(i,a)):e=i;e.length-l>=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=Rt.parseAdtsSize(e,l))>e.length)break;n={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",n),l+=o}else{if(e.length-l<10)break;if(l+(o=Rt.parseId3TagSize(e,l))>e.length)break;r={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",r),l+=o}s=e.length-l,e=s>0?e.subarray(l):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new $;var Mt,Ut,Bt,Ft,jt=Ct,qt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],$t=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Vt=$,Ht=ee,Wt=se,Gt=me,zt=fe,Xt=gt,Kt=de,Yt=vt,Qt=xt.H264Stream,Jt=jt,Zt=Nt.isLikelyAacData,ei=de.ONE_SECOND_IN_TS,ti=qt,ii=$t,si=function(e,t){t.stream=e,this.trigger("log",t)},ri=function(e,t){for(var i=Object.keys(t),s=0;s<i.length;s++){var r=i[s];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",si.bind(e,r))}},ni=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},ai=function(e,t,i,s,r,n){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(s-t),pts:e+(r-i)},prependedContentDuration:n,baseMediaDecodeTime:e}};Ut=function(e,t){var i,s=[],r=0,n=0,a=1/0;i=(t=t||{}).firstSequenceNumber||0,Ut.prototype.init.call(this),this.push=function(t){zt.collectDtsInfo(e,t),e&&ti.forEach((function(i){e[i]=t[i]})),s.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){a=e},this.setAudioAppendStart=function(e){n=e},this.flush=function(){var o,l,u,d,h,c,p;0!==s.length?(o=Gt.trimAdtsFramesByEarliestDts(s,e,r),e.baseMediaDecodeTime=zt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=Gt.prefixWithSilence(e,o,n,a),e.samples=Gt.generateSampleTable(o),u=Ht.mdat(Gt.concatenateFrameData(o)),s=[],l=Ht.moof(i,[e]),d=new Uint8Array(l.byteLength+u.byteLength),i++,d.set(l),d.set(u,l.byteLength),zt.clearDtsInfo(e),h=Math.ceil(1024*ei/e.samplerate),o.length&&(c=o.length*h,this.trigger("segmentTimingInfo",ai(Kt.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:d}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){zt.clearDtsInfo(e),s=[],this.trigger("reset")}},Ut.prototype=new Vt,Mt=function(e,t){var i,s,r,n=[],a=[];i=(t=t||{}).firstSequenceNumber||0,Mt.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){zt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.config,e.sps=[t.data],ii.forEach((function(t){e[t]=s[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),n.push(t)},this.flush=function(){for(var s,r,o,l,u,d,h,c,p=0;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(s=Wt.groupNalsIntoFrames(n),(o=Wt.groupFramesIntoGops(s))[0][0].keyFrame||((r=this.getGopForFusion_(n[0],e))?(p=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=Wt.extendFirstKeyFrame(o)),a.length){var m;if(!(m=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");zt.clearDtsInfo(e),o=m}zt.collectDtsInfo(e,o),e.samples=Wt.generateSampleTable(o),u=Ht.mdat(Wt.concatenateNalData(o)),e.baseMediaDecodeTime=zt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),h=o[0],c=o[o.length-1],this.trigger("segmentTimingInfo",ai(e.baseMediaDecodeTime,h.dts,h.pts,c.dts+c.duration,c.pts+c.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),l=Ht.moof(i,[e]),d=new Uint8Array(l.byteLength+u.byteLength),i++,d.set(l),d.set(u,l.byteLength),this.trigger("data",{track:e,boxes:d}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),n=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){zt.clearDtsInfo(e),s=void 0,r=void 0},this.getGopForFusion_=function(t){var i,s,r,n,a,o=45e3,l=1e4,u=1/0;for(a=0;a<this.gopCache_.length;a++)r=(n=this.gopCache_[a]).gop,e.pps&&ni(e.pps[0],n.pps[0])&&e.sps&&ni(e.sps[0],n.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-l&&i<=o&&(!s||u>i)&&(s=n,u=i));return s?s.gop:null},this.alignGopsAtStart_=function(e){var t,i,s,r,n,o,l,u;for(n=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;t<a.length&&i<e.length&&(s=a[t],r=e[i],s.pts!==r.pts);)r.pts>s.pts?t++:(i++,n-=r.byteLength,o-=r.nalCount,l-=r.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=n,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,s,r,n,o,l;for(t=a.length-1,i=e.length-1,n=null,o=!1;t>=0&&i>=0;){if(s=a[t],r=e[i],s.pts===r.pts){o=!0;break}s.pts>r.pts?t--:(t===a.length-1&&(n=i),i--)}if(!o&&null===n)return null;if(0===(l=o?i:n))return e;var u=e.slice(l),d=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=d.byteLength,u.duration=d.duration,u.nalCount=d.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){a=e}},Mt.prototype=new Vt,Ft=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ft.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},Ft.prototype=new Vt,Ft.prototype.flush=function(e){var t,i,s,r,n=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,ii.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ti.forEach((function(e){a.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,s=Ht.initSegment(this.pendingTracks),a.initSegment=new Uint8Array(s.byteLength),a.initSegment.set(s),a.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)a.data.set(this.pendingBoxes[r],n),n+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=Kt.metadataTsToSeconds(t.startPts,o,this.keepOriginalTimestamps),t.endTime=Kt.metadataTsToSeconds(t.endPts,o,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=Kt.metadataTsToSeconds(i.pts,o,this.keepOriginalTimestamps),a.metadata.push(i);for(a.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",a),r=0;r<a.captions.length;r++)t=a.captions[r],this.trigger("caption",t);for(r=0;r<a.metadata.length;r++)i=a.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ft.prototype.setRemux=function(e){this.remuxTracks=e},(Bt=function(e){var t,i,s=this,r=!0;Bt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Xt.MetadataStream,r.aacStream=new Jt,r.audioTimestampRolloverStream=new Xt.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Xt.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Yt,r.coalesceStream=new Ft(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(n){"timed-metadata"!==n.type&&"audio"!==n.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Ut(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ri(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Xt.MetadataStream,r.packetStream=new Xt.TransportPacketStream,r.parseStream=new Xt.TransportParseStream,r.elementaryStream=new Xt.ElementaryStream,r.timestampRolloverStream=new Xt.TimestampRolloverStream,r.adtsStream=new Yt,r.h264Stream=new Qt,r.captionStream=new Xt.CaptionStream(e),r.coalesceStream=new Ft(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(n){var a;if("metadata"===n.type){for(a=n.tracks.length;a--;)t||"video"!==n.tracks[a].type?i||"audio"!==n.tracks[a].type||((i=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new Mt(t,e),r.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Ut(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,s.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ri(this,r)},this.setBaseMediaDecodeTime=function(s){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,zt.clearDtsInfo(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,zt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=Zt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Vt;var oi,li,ui,di,hi,ci,pi,mi={Transmuxer:Bt,VideoSegmentStream:Mt,AudioSegmentStream:Ut,AUDIO_PROPERTIES:ti,VIDEO_PROPERTIES:ii,generateSegmentTimingInfo:ai},gi={toUnsigned:function(e){return e>>>0},toHexString:function(e){return("00"+e.toString(16)).slice(-2)}},fi=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},yi=gi.toUnsigned,_i=fi,bi=function(e,t){var i,s,r,n,a,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)s=yi(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=_i(e.subarray(i+4,i+8)),n=s>1?i+s:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,n)):(a=bi(e.subarray(i+8,n),t.slice(1))).length&&(o=o.concat(a))),i=n;return o},vi=bi,Ti=gi.toUnsigned,Si=H.getUint64,Ei=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Si(e.subarray(4)):t.baseMediaDecodeTime=Ti(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},wi=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ki=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],d=s.getUint32(4),h=8;for(r&&(i.dataOffset=s.getInt32(h),h+=4),n&&d&&(t={flags:wi(e.subarray(h,h+4))},h+=4,a&&(t.duration=s.getUint32(h),h+=4),o&&(t.size=s.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=s.getInt32(h):t.compositionTimeOffset=s.getUint32(h),h+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=s.getUint32(h),h+=4),o&&(t.size=s.getUint32(h),h+=4),l&&(t.flags=wi(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=s.getInt32(h):t.compositionTimeOffset=s.getUint32(h),h+=4),i.samples.push(t);return i},Ci=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&s.flags[2],n=2&s.flags[2],a=8&s.flags[2],o=16&s.flags[2],l=32&s.flags[2],u=65536&s.flags[0],d=131072&s.flags[0];return t=8,r&&(t+=4,s.baseDataOffset=i.getUint32(12),t+=4),n&&(s.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(s.defaultSampleDuration=i.getUint32(t),t+=4),o&&(s.defaultSampleSize=i.getUint32(t),t+=4),l&&(s.defaultSampleFlags=i.getUint32(t)),u&&(s.durationIsEmpty=!0),!r&&d&&(s.baseDataOffsetIsMoof=!0),s},xi="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Ii=be.discardEmulationPreventionBytes,Ai=Re.CaptionStream,Di=vi,Li=Ei,Pi=ki,Oi=Ci,Ni=xi,Ri=function(e,t){for(var i=e,s=0;s<t.length;s++){var r=t[s];if(i<r.size)return r;i-=r.size}return null},Mi=function(e,t,i){var s,r,n,a,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=n)if(n=o.getUint32(r),r+=4,!(n<=0))switch(31&e[r]){case 6:var u=e.subarray(r+1,r+1+n),d=Ri(r,t);if(s={nalUnitType:"sei_rbsp",size:n,data:u,escapedRBSP:Ii(u),trackId:i},d)s.pts=d.pts,s.dts=d.dts,a=d;else{if(!a){l.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}s.pts=a.pts,s.dts=a.dts}l.seiNals.push(s)}return l},Ui=function(e,t,i){var s=t,r=i.defaultSampleDuration||0,n=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach((function(e){var t=Pi(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=n),e.trackId=a,e.dts=s,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof s?(e.pts=s+Ni.BigInt(e.compositionTimeOffset),s+=Ni.BigInt(e.duration)):(e.pts=s+e.compositionTimeOffset,s+=e.duration)})),o=o.concat(t)})),o},Bi=function(e,t){var i=Di(e,["moof","traf"]),s=Di(e,["mdat"]),r={},n=[];return s.forEach((function(e,t){var s=i[t];n.push({mdat:e,traf:s})})),n.forEach((function(e){var i,s,n=e.mdat,a=e.traf,o=Di(a,["tfhd"]),l=Oi(o[0]),u=l.trackId,d=Di(a,["tfdt"]),h=d.length>0?Li(d[0]).baseMediaDecodeTime:0,c=Di(a,["trun"]);t===u&&c.length>0&&(i=Ui(c,h,l),s=Mi(n,i,u),r[u]||(r[u]={seiNals:[],logs:[]}),r[u].seiNals=r[u].seiNals.concat(s.seiNals),r[u].logs=r[u].logs.concat(s.logs))})),r},Fi=function(e,t,i){if(null===t)return null;var s=Bi(e,t)[t]||{};return{seiNals:s.seiNals,logs:s.logs,timescale:i}},ji=function(){var e,t,i,s,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new Ai,a=!0,n=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/s,e.endTime=e.endPts/s,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(i!==e[0]||s!==t[i])},this.parse=function(e,n,a){var o;if(!this.isInitialized())return null;if(!n||!a)return null;if(this.isNewInit(n,a))i=n[0],s=a[i];else if(null===i||!s)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,n,a)}return(o=Fi(e,i,s))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;n?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,s=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},qi=ji,$i={uint8ToCString:function(e){for(var t=0,i=String.fromCharCode(e[t]),s="";"\0"!==i;)s+=i,t++,i=String.fromCharCode(e[t]);return s+=i}}.uint8ToCString,Vi=H.getUint64,Hi=function(e){var t,i,s,r,n,a,o,l=4,u=e[0];if(0===u)l+=(t=$i(e.subarray(l))).length,l+=(i=$i(e.subarray(l))).length,s=(d=new DataView(e.buffer)).getUint32(l),l+=4,n=d.getUint32(l),l+=4,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4;else if(1===u){var d;s=(d=new DataView(e.buffer)).getUint32(l),l+=4,r=Vi(e.subarray(l)),l+=8,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4,l+=(t=$i(e.subarray(l))).length,l+=(i=$i(e.subarray(l))).length}var h={scheme_id_uri:t,value:i,timescale:s||1,presentation_time:r,presentation_time_delta:n,event_duration:a,id:o,message_data:new Uint8Array(e.subarray(l,e.byteLength))};return Gi(u,h)?h:void 0},Wi=function(e,t,i,s){return e||0===e?e/t:s+i/t},Gi=function(e,t){var i="\0"!==t.scheme_id_uri,s=0===e&&zi(t.presentation_time_delta)&&i,r=1===e&&zi(t.presentation_time)&&i;return!(e>1)&&s||r},zi=function(e){return void 0!==e||null!==e},Xi={parseEmsgBox:Hi,scaleTime:Wi},Ki=gi.toUnsigned,Yi=gi.toHexString,Qi=vi,Ji=fi,Zi=Xi,es=Ci,ts=ki,is=Ei,ss=H.getUint64,rs=xi,ns=Ze.parseId3Frames;oi=function(e){var t={};return Qi(e,["moov","trak"]).reduce((function(e,t){var i,s,r,n,a;return(i=Qi(t,["tkhd"])[0])?(s=i[0],n=Ki(i[r=0===s?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(a=Qi(t,["mdia","mdhd"])[0])?(r=0===(s=a[0])?12:20,e[n]=Ki(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]),e):null):null}),t)},li=function(e,t){var i=Qi(t,["moof","traf"]).reduce((function(t,i){var s,r=Qi(i,["tfhd"])[0],n=Ki(r[4]<<24|r[5]<<16|r[6]<<8|r[7]),a=e[n]||9e4,o=Qi(i,["tfdt"])[0],l=new DataView(o.buffer,o.byteOffset,o.byteLength);let u;return"bigint"==typeof(s=1===o[0]?ss(o.subarray(4,12)):l.getUint32(4))?u=s/rs.BigInt(a):"number"!=typeof s||isNaN(s)||(u=s/a),u<Number.MAX_SAFE_INTEGER&&(u=Number(u)),u<t&&(t=u),t}),1/0);return"bigint"==typeof i||isFinite(i)?i:0},ui=function(e,t){var i,s=Qi(t,["moof","traf"]),r=0,n=0;if(s&&s.length){var a=Qi(s[0],["tfhd"])[0],o=Qi(s[0],["trun"])[0],l=Qi(s[0],["tfdt"])[0];if(a)i=es(a).trackId;if(l)r=is(l).baseMediaDecodeTime;if(o){var u=ts(o);u.samples&&u.samples.length&&(n=u.samples[0].compositionTimeOffset||0)}}var d=e[i]||9e4;"bigint"==typeof r&&(n=rs.BigInt(n),d=rs.BigInt(d));var h=(r+n)/d;return"bigint"==typeof h&&h<Number.MAX_SAFE_INTEGER&&(h=Number(h)),h},di=function(e){var t=Qi(e,["moov","trak"]),i=[];return t.forEach((function(e){var t=Qi(e,["mdia","hdlr"]),s=Qi(e,["tkhd"]);t.forEach((function(e,t){var r,n,a=Ji(e.subarray(8,12)),o=s[t];"vide"===a&&(n=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),i.push(n))}))})),i},ci=function(e){var t=0===e[0]?12:20;return Ki(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},hi=function(e){var t=Qi(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,s,r={},n=Qi(e,["tkhd"])[0];n&&(s=(t=new DataView(n.buffer,n.byteOffset,n.byteLength)).getUint8(0),r.id=0===s?t.getUint32(12):t.getUint32(20));var a=Qi(e,["mdia","hdlr"])[0];if(a){var o=Ji(a.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var l=Qi(e,["mdia","minf","stbl","stsd"])[0];if(l){var u=l.subarray(8);r.codec=Ji(u.subarray(4,8));var d,h=Qi(u,[r.codec])[0];h&&(/^[asm]vc[1-9]$/i.test(r.codec)?(d=h.subarray(78),"avcC"===Ji(d.subarray(4,8))&&d.length>11?(r.codec+=".",r.codec+=Yi(d[9]),r.codec+=Yi(d[10]),r.codec+=Yi(d[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(d=h.subarray(28),"esds"===Ji(d.subarray(4,8))&&d.length>20&&0!==d[19]?(r.codec+="."+Yi(d[19]),r.codec+="."+Yi(d[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var c=Qi(e,["mdia","mdhd"])[0];c&&(r.timescale=ci(c)),i.push(r)})),i},pi=function(e,t=0){return Qi(e,["emsg"]).map((e=>{var i=Zi.parseEmsgBox(new Uint8Array(e)),s=ns(i.message_data);return{cueTime:Zi.scaleTime(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:Zi.scaleTime(i.event_duration,i.timescale),frames:s}}))};var as={findBox:Qi,parseType:Ji,timescale:oi,startTime:li,compositionStartTime:ui,videoTrackIds:di,tracks:hi,getTimescaleFromMediaHeader:ci,getEmsgID3:pi},os=Me,ls=function(e){var t=31&e[1];return t<<=8,t|=e[2]},us=function(e){return!!(64&e[1])},ds=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},hs=function(e){if(!us(e))return null;var t=4+ds(e);if(t>=e.byteLength)return null;var i,s=null;return 192&(i=e[t+7])&&((s={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,s.pts*=4,s.pts+=(6&e[t+13])>>>1,s.dts=s.pts,64&i&&(s.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,s.dts*=4,s.dts+=(6&e[t+18])>>>1)),s},cs=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},ps={parseType:function(e,t){var i=ls(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=us(e),i=4+ds(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=us(e),s=4+ds(e);if(i&&(s+=e[s]+1),1&e[s+5]){var r;r=3+((15&e[s+1])<<8|e[s+2])-4;for(var n=12+((15&e[s+10])<<8|e[s+11]);n<r;){var a=s+n;t[(31&e[a+1])<<8|e[a+2]]=e[a],n+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:us,parsePesType:function(e,t){switch(t[ls(e)]){case os.H264_STREAM_TYPE:return"video";case os.ADTS_STREAM_TYPE:return"audio";case os.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:hs,videoPacketContainsKeyFrame:function(e){for(var t=4+ds(e),i=e.subarray(t),s=0,r=0,n=!1;r<i.byteLength-3;r++)if(1===i[r+2]){s=r+5;break}for(;s<i.byteLength;)switch(i[s]){case 0:if(0!==i[s-1]){s+=2;break}if(0!==i[s-2]){s++;break}r+3!==s-2&&"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0);do{s++}while(1!==i[s]&&s<i.length);r=s-2,s+=3;break;case 1:if(0!==i[s-1]||0!==i[s-2]){s+=3;break}"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0),r=s-2,s+=3;break;default:s+=3}return i=i.subarray(r),s-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0),n}},ms=Me,gs=He.handleRollover,fs={};fs.ts=ps,fs.aac=Nt;var ys=de.ONE_SECOND_IN_TS,_s=188,bs=71,vs=function(e,t){for(var i,s=0,r=_s;r<e.byteLength;)if(e[s]!==bs||e[r]!==bs)s++,r++;else{switch(i=e.subarray(s,r),fs.ts.parseType(i,t.pid)){case"pat":t.pid=fs.ts.parsePat(i);break;case"pmt":var n=fs.ts.parsePmt(i);t.table=t.table||{},Object.keys(n).forEach((function(e){t.table[e]=n[e]}))}s+=_s,r+=_s}},Ts=function(e,t,i){for(var s,r,n,a,o=0,l=_s,u=!1;l<=e.byteLength;)if(e[o]!==bs||e[l]!==bs&&l!==e.byteLength)o++,l++;else{if(s=e.subarray(o,l),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"audio"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),u=!0);if(u)break;o+=_s,l+=_s}for(o=(l=e.byteLength)-_s,u=!1;o>=0;)if(e[o]!==bs||e[l]!==bs&&l!==e.byteLength)o--,l--;else{if(s=e.subarray(o,l),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"audio"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),u=!0);if(u)break;o-=_s,l-=_s}},Ss=function(e,t,i){for(var s,r,n,a,o,l,u,d=0,h=_s,c=!1,p={data:[],size:0};h<e.byteLength;)if(e[d]!==bs||e[h]!==bs)d++,h++;else{if(s=e.subarray(d,h),"pes"===fs.ts.parseType(s,t.pid))if(r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"video"===r&&(n&&!c&&(a=fs.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0),!i.firstKeyFrame)){if(n&&0!==p.size){for(o=new Uint8Array(p.size),l=0;p.data.length;)u=p.data.shift(),o.set(u,l),l+=u.byteLength;if(fs.ts.videoPacketContainsKeyFrame(o)){var m=fs.ts.parsePesTime(o);m?(i.firstKeyFrame=m,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(s),p.size+=s.byteLength}if(c&&i.firstKeyFrame)break;d+=_s,h+=_s}for(d=(h=e.byteLength)-_s,c=!1;d>=0;)if(e[d]!==bs||e[h]!==bs)d--,h--;else{if(s=e.subarray(d,h),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"video"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0);if(c)break;d-=_s,h-=_s}},Es=function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=gs(e.dts,i),e.pts=gs(e.pts,i),e.dtsTime=e.dts/ys,e.ptsTime=e.pts/ys}))}if(e.video&&e.video.length){var s=t;if((void 0===s||isNaN(s))&&(s=e.video[0].dts),e.video.forEach((function(e){e.dts=gs(e.dts,s),e.pts=gs(e.pts,s),e.dtsTime=e.dts/ys,e.ptsTime=e.pts/ys})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=gs(r.dts,s),r.pts=gs(r.pts,s),r.dtsTime=r.dts/ys,r.ptsTime=r.pts/ys}}},ws=function(e){for(var t,i=!1,s=0,r=null,n=null,a=0,o=0;e.length-o>=3;){switch(fs.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=fs.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=fs.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=fs.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=fs.aac.parseSampleRate(t)),s++,o+=a;break;default:o++}if(i)return null}if(null===r||null===n)return null;var l=ys/r;return{audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*s*l,pts:n+1024*s*l}]}},ks=function(e){var t={pid:null,table:null},i={};for(var s in vs(e,t),t.table){if(t.table.hasOwnProperty(s))switch(t.table[s]){case ms.H264_STREAM_TYPE:i.video=[],Ss(e,t,i),0===i.video.length&&delete i.video;break;case ms.ADTS_STREAM_TYPE:i.audio=[],Ts(e,t,i),0===i.audio.length&&delete i.audio}}return i},Cs={inspect:function(e,t){var i;return(i=fs.aac.isLikelyAacData(e)?ws(e):ks(e))&&(i.audio||i.video)?(Es(i,t),i):null},parseAudioPes_:Ts};const xs=function(e,t){t.on("data",(function(t){const i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};const s=t.data;t.data=s.buffer,e.postMessage({action:"data",segment:t,byteOffset:s.byteOffset,byteLength:s.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){const i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){const i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))};class Is{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new mi.Transmuxer(this.options),xs(this.self,this.transmuxer)}pushMp4Captions(e){this.captionParser||(this.captionParser=new qi,this.captionParser.init());const t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){const i=as.startTime(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:t},[t.buffer])}probeMp4Tracks({data:e}){const t=as.tracks(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){const i="number"!=typeof t||isNaN(t)?void 0:t*de.ONE_SECOND_IN_TS,s=Cs.inspect(e,i);let r=null;s&&(r={hasVideo:s.video&&2===s.video.length||!1,hasAudio:s.audio&&2===s.audio.length||!1},r.hasVideo&&(r.videoStart=s.video[0].ptsTime),r.hasAudio&&(r.audioStart=s.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:r,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){const t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}reset(){this.transmuxer.reset()}setTimestampOffset(e){const t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(de.secondsToVideoTs(t)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(de.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Is(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Is(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));var rm=em(sm);const nm=(e,t,i)=>{const{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:u}=e.data.segment;t.buffer.push({captions:n,captionStreams:a,metadata:o});const d=e.data.segment.boxes||{data:e.data.segment.data},h={type:s,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==u&&(h.videoFramePtsTime=u),i(h)},am=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},om=(e,t)=>{t.gopInfo=e.data.gopInfo},lm=e=>{const{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:u,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=e,_={buffer:[]};let b=y;const v=i=>{t.currentTransmux===e&&("data"===i.data.action&&nm(i,_,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&om(i,_),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(b=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(b||(t.onmessage=null,am({transmuxedData:_,callback:m}),um(t))))};if(t.onmessage=v,s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength){const e=i instanceof ArrayBuffer?i:i.buffer,s=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:e,byteOffset:s,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},um=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():lm(e.currentTransmux))},dm=(e,t)=>{e.postMessage({action:t}),um(e)},hm=(e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void dm(t,e);t.transmuxQueue.push(dm.bind(null,t,e))},cm=e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void lm(e);e.transmuxer.transmuxQueue.push(e)};var pm={reset:e=>{hm("reset",e)},endTimeline:e=>{hm("endTimeline",e)},transmux:cm,createTransmuxer:e=>{const t=new rm;t.currentTransmux=null,t.transmuxQueue=[];const i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t}};const mm=function(e){const t=e.transmuxer,i=e.endAction||e.action,s=e.callback,r=He({},e,{endAction:null,transmuxer:null,callback:null}),n=r=>{r.data.action===i&&(t.removeEventListener("message",n),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),s(r.data))};if(t.addEventListener("message",n),e.data){const i=e.data instanceof ArrayBuffer;r.byteOffset=i?0:e.data.byteOffset,r.byteLength=e.data.byteLength;const s=[i?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},gm={FAILURE:2,TIMEOUT:-101,ABORTED:-102},fm=e=>{e.forEach((e=>{e.abort()}))},ym=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),_m=e=>{const t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},bm=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:gm.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:gm.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:gm.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:gm.FAILURE,xhr:t}:null,vm=(e,t,i)=>(s,r)=>{const n=r.response,a=bm(s,r);if(a)return i(a,e);if(16!==n.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:gm.FAILURE,xhr:r},e);const o=new DataView(n),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let e=0;e<t.length;e++)t[e].bytes=l;return i(null,e)},Tm=(e,t)=>{const i=la(e.map.bytes);if("mp4"!==i){const s=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${s}`,code:gm.FAILURE})}mm({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:s})=>(e.map.bytes=s,i.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null))})},Sm=({segment:e,finishProcessingFn:t})=>(i,s)=>{const r=bm(i,s);if(r)return t(r,e);const n=new Uint8Array(s.response);if(e.map.key)return e.map.encryptedBytes=n,t(null,e);e.map.bytes=n,Tm(e,(function(i){if(i)return i.xhr=s,i.status=s.status,t(i,e);t(null,e)}))},Em=({segment:e,finishProcessingFn:t,responseType:i})=>(s,r)=>{const n=bm(s,r);if(n)return t(n,e);const a="arraybuffer"!==i&&r.responseText?Qp(r.responseText.substring(e.lastReachedChar||0)):r.response;return e.stats=ym(r),e.key?e.encryptedBytes=new Uint8Array(a):e.bytes=new Uint8Array(a),t(null,e)},wm=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{const p=e.map&&e.map.tracks||{},m=Boolean(p.audio&&p.video);let g=s.bind(null,e,"audio","start");const f=s.bind(null,e,"audio","end");let y=s.bind(null,e,"video","start");const _=s.bind(null,e,"video","end"),b=()=>cm({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,d(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{g&&void 0!==e.start&&(g(e.start),g=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}});mm({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data;const r=s.result;r&&(i(e,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:m}),i=null,r.hasAudio&&!m&&g(r.audioStart),r.hasVideo&&y(r.videoStart),g=null,y=null),b()}})},km=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(ua(p)){e.isFmp4=!0;const{tracks:r}=e.map,n={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio};r.audio&&r.audio.codec&&"enca"!==r.audio.codec&&(n.audioCodec=r.audio.codec),r.video&&r.video.codec&&"encv"!==r.video.codec&&(n.videoCodec=r.video.codec),r.video&&r.audio&&(n.isMuxed=!0),i(e,n);const a=t=>{d(e,{data:p,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),t&&t.length&&o(e,t),h(null,e,{})};mm({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:o})=>{t=i.buffer,e.bytes=p=i,n.hasAudio&&!n.isMuxed&&s(e,"audio","start",o),n.hasVideo&&s(e,"video","start",o),r.video&&i.byteLength&&e.transmuxer?mm({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach((function(e){c(cc(e,{stream:"mp4CaptionParser"}))})),a(i.captions)}}):a()}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=la(p)),"ts"!==e.container&&"aac"!==e.container)return i(e,{hasAudio:!1,hasVideo:!1}),void h(null,e,{});wm({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})}else h(null,e,{})},Cm=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s},r){const n=t=>{if(t.data.source===e){s.removeEventListener("message",n);const e=t.data.decrypted;r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let a;s.addEventListener("message",n),a=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(Sp({source:e,encrypted:i,key:a,iv:t.iv}),[i.buffer,a.buffer])},xm=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{Cm({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,km({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})}))},Im=({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(g,f)=>{if(!m){if(g)return m=!0,fm(e),h(g,f);if(p+=1,p===e.length){const p=function(){if(f.encryptedBytes)return xm({decryptionWorker:t,segment:f,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c});km({segment:f,bytes:f.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return Cm({decryptionWorker:t,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},(t=>{f.map.bytes=t,Tm(f,(t=>{if(t)return fm(e),h(t,f);p()}))}));p()}}}},Am=({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)},Dm=({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d})=>i=>{if(!i.target.aborted)return e.stats=cc(e.stats,_m(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)},Lm=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[],_=Im({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f});if(s.key&&!s.key.bytes){const i=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&i.push(s.map.key);const r=e(cc(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),vm(s,i,_));y.push(r)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){const i=e(cc(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),vm(s,[s.map.key],_));y.push(i)}const i=e(cc(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:_p(s.map)}),Sm({segment:s,finishProcessingFn:_}));y.push(i)}const b=cc(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:_p(s)}),v=e(b,Em({segment:s,finishProcessingFn:_,responseType:b.responseType}));v.addEventListener("progress",Dm({segment:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(v);const T={};return y.forEach((e=>{e.addEventListener("loadend",Am({loadendState:T,abortFn:r}))})),()=>fm(y)},Pm=hc("CodecUtils"),Om=function(e){const t=e.attributes||{};if(t.CODECS)return dt(t.CODECS)},Nm=(e,t)=>{const i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Rm=(e,t)=>{if(!Nm(e,t))return!0;const i=t.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(const r in s)if(!s[r].uri&&!s[r].playlists)return!0;return!1},Mm=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push(ut(`${i}${s}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return Pm(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),void(t[e]=null);t[e]=t[e][0]})),t},Um=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},Bm=function(e,t){const i=t.attributes||{},s=Mm(Om(t)||[]);if(Nm(e,t)&&!s.audio&&!Rm(e,t)){const t=Mm(ht(e,i.AUDIO)||[]);t.audio&&(s.audio=t.audio)}return s},Fm=hc("PlaylistSelector"),jm=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},qm=function(e,t){if(!e)return"";const i=g.getComputedStyle(e);return i?i[t]:""},$m=function(e,t){const i=e.slice();e.sort((function(e,s){const r=t(e,s);return 0===r?i.indexOf(e)-i.indexOf(s):r}))},Vm=function(e,t){let i,s;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||g.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(s=t.attributes.BANDWIDTH),s=s||g.Number.MAX_VALUE,i-s},Hm=function(e,t){let i,s;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||g.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),s=s||g.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s};let Wm=function(e,t,i,s,r,n){if(!e)return;const a={bandwidth:t,width:i,height:s,limitRenditionByPlayerDimensions:r};let o=e.playlists;zc.isAudioOnly(e)&&(o=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map((e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,s=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||g.Number.MAX_VALUE,{bandwidth:t,width:i,height:s,playlist:e}}));$m(l,((e,t)=>e.bandwidth-t.bandwidth)),l=l.filter((e=>!zc.isIncompatible(e.playlist)));let u=l.filter((e=>zc.isEnabled(e.playlist)));u.length||(u=l.filter((e=>!zc.isDisabled(e.playlist))));const d=u.filter((e=>e.bandwidth*Yp.BANDWIDTH_VARIANCE<t));let h=d[d.length-1];const c=d.filter((e=>e.bandwidth===h.bandwidth))[0];if(!1===r){const e=c||u[0]||l[0];if(e&&e.playlist){let t="sortedPlaylistReps";return c&&(t="bandwidthBestRep"),u[0]&&(t="enabledPlaylistReps"),Fm(`choosing ${jm(e)} using ${t} with options`,a),e.playlist}return Fm("could not choose a playlist with options",a),null}const p=d.filter((e=>e.width&&e.height));$m(p,((e,t)=>e.width-t.width));const m=p.filter((e=>e.width===i&&e.height===s));h=m[m.length-1];const f=m.filter((e=>e.bandwidth===h.bandwidth))[0];let y,_,b,v;if(f||(y=p.filter((e=>e.width>i||e.height>s)),_=y.filter((e=>e.width===y[0].width&&e.height===y[0].height)),h=_[_.length-1],b=_.filter((e=>e.bandwidth===h.bandwidth))[0]),n.leastPixelDiffSelector){const e=p.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-s),e)));$m(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),v=e[0]}const T=v||b||f||c||u[0]||l[0];if(T&&T.playlist){let e="sortedPlaylistReps";return v?e="leastPixelDiffRep":b?e="resolutionPlusOneRep":f?e="resolutionBestRep":c?e="bandwidthBestRep":u[0]&&(e="enabledPlaylistReps"),Fm(`choosing ${jm(T)} using ${e} with options`,a),T.playlist}return Fm("could not choose a playlist with options",a),null};const Gm=function(){const e=this.useDevicePixelRatio&&g.devicePixelRatio||1;return Wm(this.playlists.main,this.systemBandwidth,parseInt(qm(this.tech_.el(),"width"),10)*e,parseInt(qm(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},zm=function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const s=this.useDevicePixelRatio&&g.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Wm(this.playlists.main,t,parseInt(qm(this.tech_.el(),"width"),10)*s,parseInt(qm(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)}},Xm=function(e){const{main:t,currentTime:i,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e,u=t.playlists.filter((e=>!zc.isIncompatible(e)));let d=u.filter(zc.isEnabled);d.length||(d=u.filter((e=>!zc.isDisabled(e))));const h=d.filter(zc.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:zc.estimateSegmentRequestTime(n,s,e)*t-a}})),c=h.filter((e=>e.rebufferingImpact<=0));return $m(c,((e,t)=>Vm(t.playlist,e.playlist))),c.length?c[0]:($m(h,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),h[0]||null)},Km=function(){const e=this.playlists.main.playlists.filter(zc.isEnabled);$m(e,((e,t)=>Vm(e,t)));return e.filter((e=>!!Bm(this.playlists.main,e).video))[0]||null},Ym=e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,i),i+=e.byteLength}))),t},Qm=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let s=i;/^cc708_/.test(i)&&(s="SERVICE"+i.split("_")[1]);const r=t.textTracks().getTrackById(s);if(r)e[i]=r;else{let r=i,n=i,a=!1;const o=(t.options_.vhs&&t.options_.vhs.captionServices||{})[s];o&&(r=o.label,n=o.language,a=o.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:s,default:a,label:r,language:n},!1).track}}},Jm=function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;const s=g.WebKitDataCue||g.VTTCue;t.forEach((t=>{const r=t.stream;e[r].addCue(new s(t.startTime+i,t.endTime+i,t.text))}))},Zm=function(e){Object.defineProperties(e.frame,{id:{get:()=>(ic.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(ic.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(ic.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})},eg=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(!t)return;const r=g.WebKitDataCue||g.VTTCue,n=e.metadataTrack_;if(!n)return;if(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||g.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((e=>{const i=new r(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,Zm(i),n.addCue(i)}))})),!n.cues||!n.cues.length)return;const a=n.cues,o=[];for(let d=0;d<a.length;d++)a[d]&&o.push(a[d]);const l=o.reduce(((e,t)=>{const i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),u=Object.keys(l).sort(((e,t)=>Number(e)-Number(t)));u.forEach(((e,t)=>{const i=l[e],r=Number(u[t+1])||s;i.forEach((e=>{e.endTime=r}))}))},tg=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)},ig=function(e,t,i){let s,r;if(i&&i.cues)for(s=i.cues.length;s--;)r=i.cues[s],r.startTime>=e&&r.endTime<=t&&i.removeCue(r)},sg=function(e){const t=e.cues;if(t)for(let i=0;i<t.length;i++){const s=[];let r=0;for(let e=0;e<t.length;e++)t[i].startTime===t[e].startTime&&t[i].endTime===t[e].endTime&&t[i].text===t[e].text&&(r++,r>1&&s.push(t[e]));s.length&&s.forEach((t=>e.removeCue(t)))}},rg=(e,t,i)=>{if(null==t||!e.length)return[];const s=Math.ceil((t-i+3)*ha.ONE_SECOND_IN_TS);let r;for(r=0;r<e.length&&!(e[r].pts>s);r++);return e.slice(r)},ng=(e,t,i)=>{if(!t.length)return e;if(i)return t.slice();const s=t[0].pts;let r=0;for(;r<e.length&&!(e[r].pts>=s);r++);return e.slice(0,r).concat(t)},ag=(e,t,i,s)=>{const r=Math.ceil((t-s)*ha.ONE_SECOND_IN_TS),n=Math.ceil((i-s)*ha.ONE_SECOND_IN_TS),a=e.slice();let o=e.length;for(;o--&&!(e[o].pts<=n););if(-1===o)return a;let l=o+1;for(;l--&&!(e[l].pts<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a},og=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;const i=Object.keys(e).sort(),s=Object.keys(t).sort();if(i.length!==s.length)return!1;for(let r=0;r<i.length;r++){const n=i[r];if(n!==s[r])return!1;if(e[n]!==t[n])return!1}return!0},lg=22,ug=function(e,t,i){t=t||[];const s=[];let r=0;for(let n=0;n<t.length;n++){const a=t[n];if(e===a.timeline&&(s.push(n),r+=a.duration,r>i))return n}return 0===s.length?0:s[s.length-1]},dg=1,hg=500,cg=e=>"number"==typeof e&&isFinite(e),pg=1/60,mg=(e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null,gg=(e,t,i)=>{let s=t-Yp.BACK_BUFFER_LENGTH;e.length&&(s=Math.max(s,e.start(0)));const r=t-i;return Math.min(r,s)},fg=e=>{const{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:u,timeline:d}=e,h=o.length-1;let c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);const p="number"==typeof u,m=e.segment.uri?"segment":"pre-segment",g=p?Dc({preloadSegment:s})-1:0;return`${m} [${n+l}/${n+h}]`+(p?` part [${u}/${g}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(p?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},yg=e=>`${e}TimingInfo`,_g=({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r})=>r||e!==t?e<t?i:s.length?s.end(s.length-1):i:null,bg=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{if(t===i)return!1;if("audio"===s){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===s&&r){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},vg=e=>{let t=0;return["video","audio"].forEach((function(i){const s=e[`${i}TimingInfo`];if(!s)return;const{start:r,end:n}=s;let a;"bigint"==typeof r||"bigint"==typeof n?a=g.BigInt(n)-g.BigInt(r):"number"==typeof r&&"number"==typeof n&&(a=n-r),void 0!==a&&a>t&&(t=a)})),"bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),t},Tg=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+mc,Sg=(e,t)=>{if("hls"!==t)return null;const i=vg({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;const s=e.playlist.targetDuration,r=Tg({segmentDuration:i,maxDuration:2*s}),n=Tg({segmentDuration:i,maxDuration:s}),a=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.duration} and the target duration is ${s}. 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 r||n?{severity:r?"warn":"info",message:a}:null};class Eg extends ic.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=ic.browser.IE_VERSION>=11,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_=hc(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return pm.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_&&g.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}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,g.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&pm.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return pc();if("main"===this.loaderType_){const{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ep(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const i=wp(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(s||e).resolvedUri};return s&&(r.bytes=s.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const i=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const n=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${n}]`),null!==this.mediaIndex)if(this.mediaIndex-=n,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}s&&(s.mediaIndex-=n,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&pm.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=(()=>{}),s=!1){if(t===1/0&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let r=1;const n=()=>{r--,0===r&&i()};!s&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,n)),(s||"main"===this.loaderType_)&&(this.gopBuffer_=ag(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,n));for(const a in this.inbandTextTracks_)ig(e,t,this.inbandTextTracks_[a]);ig(e,t,this.segmentMetadataTrack_),n()}monitorBuffer_(){this.checkBufferTimeout_&&g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.setTimeout(this.monitorBufferTick_.bind(this),hg)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const s="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,n=!s||!s.parts||i+1===s.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&n}chooseNextRequest_(){const e=this.buffered_(),t=kc(e)||0,i=Cc(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||s||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(a.isSyncRequest)a.mediaIndex=ug(this.currentTimeline_,n,t);else if(null!==this.mediaIndex){const e=n[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=i+1):a.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:e,startTime:i,partIndex:s}=zc.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});a.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,a.mediaIndex=e,a.startOfSegment=i,a.partIndex=s}const o=n[a.mediaIndex];let l=o&&"number"==typeof a.partIndex&&o.parts&&o.parts[a.partIndex];if(!o||"number"==typeof a.partIndex&&!l)return null;if("number"!=typeof a.partIndex&&o.parts&&(a.partIndex=0,l=o.parts[0]),!i&&l&&!l.independent)if(0===a.partIndex){const e=n[a.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(a.mediaIndex-=1,a.partIndex=e.parts.length-1,a.independent="previous segment")}else o.parts[a.partIndex-1].independent&&(a.partIndex-=1,a.independent="previous part");const u=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=n.length-1&&u&&!this.seeking_()?null:this.generateSegmentInfo_(a)}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:s,startOfSegment:r,isSyncRequest:n,partIndex:a,forceTimestampOffset:o,getMediaInfoForTime:l}=e,u=i.segments[s],d="number"==typeof a&&u.parts[a],h={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:s,partIndex:d?a:null,isSyncRequest:n,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:c});const p=kc(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=rg(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h}timestampOffsetForSegment_(e){return _g(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,r=zc.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),n=Sc(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=n)return;const a=Xm({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:n,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!a)return;const o=r-n-a.rebufferingImpact;let l=.5;n<=mc&&(l=1),!a.playlist||a.playlist.uri===this.playlist_.uri||o<l||(this.bandwidth=a.playlist.attributes.BANDWIDTH*Yp.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${fg(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}handleTrackInfo_(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},og(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))}handleTimingInfo_(e,t,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const r=this.pendingSegment_,n=yg(t);r[n]=r[n]||{},r[n][i]=s,this.logger_(`timinginfo: ${t} - ${i} - ${s}`),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(0===t.length)return void this.logger_("SegmentLoader received no captions from a caption event");if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));const i=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),s={};t.forEach((e=>{s[e.stream]=s[e.stream]||{startTime:1/0,captions:[],endTime:0};const t=s[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)})),Object.keys(s).forEach((e=>{const{startTime:t,endTime:r,captions:n}=s[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${r} for ${e}`),Qm(a,this.vhs_.tech_,e),ig(t,r,a[e]),Jm({captionArray:n,inbandTextTracks:a,timestampOffset:i})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));const s=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();tg(this.inbandTextTracks_,i,this.vhs_.tech_),eg({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration: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((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:s,isMuxed:r}=t;return!(s&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return void this.callQueue_.push(this.handleData_.bind(this,e,t));const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[yg(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let s;t&&(s=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:s,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});const e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){const e=Ep(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){const r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ec(r).join(", ")),n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ec(n).join(", "));const a=r.length?r.start(0):0,o=r.length?r.end(r.length-1):0,l=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0;if(o-a<=dg&&u-l<=dg)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${Ec(r).join(", ")}, video buffer: ${Ec(n).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const d=this.currentTime_()-dg;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${d}`),this.remove(0,d,(()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${dg}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=g.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3*dg)}),!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(s.code!==lg?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){const e=[s];let t=s.byteLength;i&&(e.unshift(i),t+=i.byteLength),r=Ym({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,r=`${e}TimingInfo`;s[r]||(s[r]={}),s[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[r].transmuxedPresentationStart=i.start.presentation,s[r].transmuxedDecodeStart=i.start.decode,s[r].transmuxedPresentationEnd=i.end.presentation,s[r].transmuxedDecodeEnd=i.end.decode,s[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:s}=t;if(!s||!s.byteLength)return;if("audio"===i&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:s})}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{const t=He({},e,{forceTimestampOffset:!0});He(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}))}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&e.timeline>0,n=i||s&&r;this.logger_(`Requesting ${fg(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Lm({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:n,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:s})=>{this.logger_(`${fg(e)} logged from transmuxer stream ${s} as a ${i}: ${t}`)}})}trimBackBuffer_(e){const t=gg(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,s={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?s.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(s.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){const i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);s.key=this.segmentKey(t.key),s.key.iv=i}return t.map&&(s.map=this.initSegmentForMap(t.map)),s}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<pg?this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${pg}`):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length)return void this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return;if(t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===gm.ABORTED)return;return this.pause(),e.code===gm.TIMEOUT?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),s.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=ng(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){if(void 0!==e)return e;if(!n)return o.start;const l=t.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===s+r?a.start:s}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:i,hasVideo:s,isMuxed:r}=t,n="main"===this.loaderType_&&s,a=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);n&&e.waitingOnAppends++,a&&e.waitingOnAppends++,n&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),a&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=mg(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=Sg(e,this.sourceType_);if(t&&("warn"===t.severity?ic.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_))return void this.logger_(`Throwing away un-appended sync request ${fg(e)}`);this.logger_(`Appended ${fg(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,s=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,n=s&&s.end&&this.currentTime_()-s.end>3*e.playlist.partTargetDuration;if(r||n)return this.logger_(`bad ${r?"segment":"part"} ${fg(e)}`),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<pg)return void this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${pg}`);const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,s=t.end;if(!cg(i)||!cg(s))return;ig(i,s,this.segmentMetadataTrack_);const r=g.WebKitDataCue||g.VTTCue,n={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:s},a=new r(i,s,JSON.stringify(n));a.value=n,this.segmentMetadataTrack_.addCue(a)}}function wg(){}const kg=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Cg=["video","audio"],xg=(e,t)=>{const i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},Ig=(e,t)=>{for(let i=0;i<t.length;i++){const s=t[i];if("mediaSource"===s.type)return null;if(s.type===e)return i}return null},Ag=(e,t)=>{if(0===t.queue.length)return;let i=0,s=t.queue[i];if("mediaSource"!==s.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!xg(e,t)){if(s.type!==e){if(i=Ig(e,t.queue),null===i)return;s=t.queue[i]}return t.queue.splice(i,1),t.queuePending[e]=s,s.action(e,t),s.doneFn?void 0:(t.queuePending[e]=null,void Ag(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),s.action(t),s.doneFn&&s.doneFn(),Ag("audio",t),Ag("video",t))},Dg=(e,t)=>{const i=t[`${e}Buffer`],s=kg(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},Lg=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Pg={appendBuffer:(e,t,i)=>(s,r)=>{const n=r[`${s}Buffer`];if(Lg(r.mediaSource,n)){r.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{n.appendBuffer(e)}catch(Gf){r.logger_(`Error with code ${Gf.code} `+(Gf.code===lg?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${s}Buffer`),r.queuePending[s]=null,i(Gf)}}},remove:(e,t)=>(i,s)=>{const r=s[`${i}Buffer`];if(Lg(s.mediaSource,r)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(Gf){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},timestampOffset:e=>(t,i)=>{const s=i[`${t}Buffer`];Lg(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),s.timestampOffset=e)},callback:e=>(t,i)=>{e()},endOfStream:e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(Gf){ic.log.warn("Failed to call media source endOfStream",Gf)}}},duration:e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(Gf){ic.log.warn("Failed to set media source duration",Gf)}},abort:()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;const i=t[`${e}Buffer`];if(Lg(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(Gf){ic.log.warn(`Failed to abort on ${e}Buffer`,Gf)}}},addSourceBuffer:(e,t)=>i=>{const s=kg(e),r=mt(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const n=i.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",i[`on${s}UpdateEnd_`]),n.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=n},removeSourceBuffer:e=>t=>{const i=t[`${e}Buffer`];if(Dg(e,t),Lg(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(Gf){ic.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,Gf)}}},changeType:e=>(t,i)=>{const s=i[`${t}Buffer`],r=mt(e);Lg(i.mediaSource,s)&&i.codecs[t]!==e&&(i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`),s.changeType(r),i.codecs[t]=e)}},Og=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),Ag(e,t)},Ng=(e,t)=>i=>{if(t.queuePending[e]){const i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}Ag(e,t)};class Rg extends ic.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Ag("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=hc("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Ng("video",this),this.onAudioUpdateEnd_=Ng("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Og({type:"mediaSource",sourceUpdater:this,action:Pg.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Og({type:e,sourceUpdater:this,action:Pg.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?Og({type:"mediaSource",sourceUpdater:this,action:Pg.removeSourceBuffer(e),name:"removeSourceBuffer"}):ic.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!ic.browser.IE_VERSION&&!ic.browser.IS_FIREFOX&&g.MediaSource&&g.MediaSource.prototype&&"function"==typeof g.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return g.SourceBuffer&&g.SourceBuffer.prototype&&"function"==typeof g.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?Og({type:e,sourceUpdater:this,action:Pg.changeType(t),name:"changeType"}):ic.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){const{segmentInfo:i,type:s,bytes:r}=e;if(this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${r.length} until video append`);const n=t;if(Og({type:s,sourceUpdater:this,action:Pg.appendBuffer(r,i||{mediaIndex:-1},n),doneFn:t,name:"appendBuffer"}),"video"===s){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach((e=>{this.appendBuffer.apply(this,e)}))}}audioBuffered(){return Lg(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:pc()}videoBuffered(){return Lg(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:pc()}buffered(){const e=Lg(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Lg(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():vc(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=wg){Og({type:"mediaSource",sourceUpdater:this,action:Pg.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=wg){"string"!=typeof e&&(e=void 0),Og({type:"mediaSource",sourceUpdater:this,action:Pg.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=wg){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Og({type:"audio",sourceUpdater:this,action:Pg.remove(e,t),doneFn:i,name:"remove"}):i()}removeVideo(e,t,i=wg){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Og({type:"video",sourceUpdater:this,action:Pg.remove(e,t),doneFn:i,name:"remove"}):i()}updating(){return!(!xg("audio",this)&&!xg("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Og({type:"audio",sourceUpdater:this,action:Pg.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Og({type:"video",sourceUpdater:this,action:Pg.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Og({type:"audio",sourceUpdater:this,action:Pg.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Og({type:"video",sourceUpdater:this,action:Pg.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Cg.forEach((e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>Dg(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Mg=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Ug=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class Bg extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Fg extends Eg{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return pc();const e=this.subtitlesTrack_.cues;return pc([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ep(e);let s=this.initSegments_[i];if(t&&!s&&e.bytes){const t=Ug.byteLength+e.bytes.byteLength,r=new Uint8Array(t);r.set(e.bytes),r.set(Ug,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:r}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){ig(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===gm.TIMEOUT&&this.handleTimeout_(),e.code===gm.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const r=s.segment;if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof g.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));r.requested=!0;try{this.parseVTTCues_(s)}catch(Gf){return void this.stopForError({message:Gf.message})}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new g.VTTCue(e.startTime,e.endTime,e.text):e)})),sg(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof g.WebVTT)throw new Bg;"function"==typeof g.TextDecoder?t=new g.TextDecoder("utf8"):(t=g.WebVTT.StringDecoder(),i=!0);const s=new g.WebVTT.Parser(g,g.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=t=>{e.timestampmap=t},s.onparsingerror=e=>{ic.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=Mg(t)),s.parse(t)}let r=e.bytes;i&&(r=Mg(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){const s=e.segment;if(!t)return;if(!e.cues.length)return void(s.empty=!0);const r=e.timestampmap,n=r.MPEGTS/ha.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((e=>{e.startTime+=n,e.endTime+=n})),!i.syncInfo){const t=e.cues[0].startTime,r=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,r-s.duration)}}}}const jg=function(e,t){const i=e.cues;for(let s=0;s<i.length;s++){const e=i[s];if(t>=e.adStartTime&&t<=e.adEndTime)return e}return null},qg=function(e,t,i=0){if(!e.segments)return;let s,r=i;for(let n=0;n<e.segments.length;n++){const i=e.segments[n];if(s||(s=jg(t,r+i.duration/2)),s){if("cueIn"in i){s.endTime=r,s.adEndTime=r,r+=i.duration,s=null;continue}if(r<s.endTime){r+=i.duration;continue}s.endTime+=i.duration}else if("cueOut"in i&&(s=new g.VTTCue(r,r+i.duration,i.cueOut),s.adStartTime=r,s.adEndTime=r+parseFloat(i.cueOut),t.addCue(s)),"cueOutCont"in i){const[e,n]=i.cueOutCont.split("/").map(parseFloat);s=new g.VTTCue(r,r+i.duration,""),s.adStartTime=r-e,s.adEndTime=s.adStartTime+n,t.addCue(s)}r+=i.duration}},$g=86400,Vg=[{name:"VOD",run:(e,t,i,s,r)=>{if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:(e,t,i,s,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=Ic(t);r=r||0;for(let l=0;l<o.length;l++){const i=o[t.endList||0===r?l:o.length-(l+1)],s=i.segment,u=e.timelineToDatetimeMappings[s.timeline];if(!u||!s.dateTimeObject)continue;let d=s.dateTimeObject.getTime()/1e3+u;if(s.parts&&"number"==typeof i.partIndex)for(let e=0;e<i.partIndex;e++)d+=s.parts[e].duration;const h=Math.abs(r-d);if(null!==a&&(0===h||a<h))break;a=h,n={time:d,segmentIndex:i.segmentIndex,partIndex:i.partIndex}}return n}},{name:"Segment",run:(e,t,i,s,r)=>{let n=null,a=null;r=r||0;const o=Ic(t);for(let l=0;l<o.length;l++){const e=o[t.endList||0===r?l:o.length-(l+1)],i=e.segment,u=e.part&&e.part.start||i&&i.start;if(i.timeline===s&&void 0!==u){const t=Math.abs(r-u);if(null!==a&&a<t)break;(!n||null===a||a>=t)&&(a=t,n={time:u,segmentIndex:e.segmentIndex,partIndex:e.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,s,r)=>{let n=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s<t.discontinuityStarts.length;s++){const a=t.discontinuityStarts[s],o=t.discontinuitySequence+s+1,l=e.discontinuities[o];if(l){const e=Math.abs(r-l.time);if(null!==i&&i<e)break;(!n||null===i||i>=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{if(t.syncInfo){return{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}}return null}}];class Hg extends ic.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=hc("SyncController")}getSyncPoint(e,t,i,s){const r=this.runStrategies_(e,t,i,s);return r.length?this.selectSyncPoint_(r,{key:"time",value:s}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+Mc({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s){const r=[];for(let n=0;n<Vg.length;n++){const a=Vg[n],o=a.run(this,e,t,i,s);o&&(o.strategy=a.name,r.push({strategy:a.name,syncPoint:o}))}return r}selectSyncPoint_(e,t){let i=e[0].syncPoint,s=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy;for(let n=1;n<e.length;n++){const a=Math.abs(e[n].syncPoint[t.key]-t.value);a<s&&(s=a,i=e[n].syncPoint,r=e[n].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${r}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+("number"==typeof i.partIndex?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>$g)ic.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let s=i-1;s>=0;s--){const i=e.segments[s];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+s,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const r=s.dateTimeObject;s.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[s.timeline]=-r.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const s=e.segment,r=e.part;let n,a,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),n=e.startOfSegment,a=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,a=t.end+o.mapping}return r&&(r.start=n,r.end=a),(!s.start||n<s.start)&&(s.start=n),s.end=a,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let s=0;s<t.discontinuityStarts.length;s++){const r=t.discontinuityStarts[s],n=t.discontinuitySequence+s+1,a=r-e.mediaIndex,o=Math.abs(a);if(!this.discontinuities[n]||this.discontinuities[n].accuracy>o){let s;s=a<0?i.start-Mc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+Mc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:s,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class Wg extends ic.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Gg=tm(im((function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function t(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}const i=function(){const e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;const l=[],u=[];let d,h,c,p,m,g;for(n=0;n<256;n++)u[(l[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=d||1,o=u[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,s[a]=p,r[p]=a,c=l[h=l[d=l[a]]],g=16843009*c^65537*h^257*d^16843008*a,m=257*l[p]^16843008*p,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][p]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e};let s=null;class r{constructor(e){let t,r,n;s||(s=i()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];const a=this._tables[0][4],o=this._tables[1],l=e.length;let u=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");const d=e.slice(0),h=[];for(this._key=[d,h],t=l;t<4*l+28;t++)n=d[t-1],(t%l==0||8===l&&t%l==4)&&(n=a[n>>>24]<<24^a[n>>16&255]<<16^a[n>>8&255]<<8^a[255&n],t%l==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),d[t]=d[t-l]^n;for(r=0;t;r++,t--)n=d[3&r?t:t-4],h[r]=t<=4||r<4?n:o[0][a[n>>>24]]^o[1][a[n>>16&255]]^o[2][a[n>>8&255]]^o[3][a[255&n]]}decrypt(e,t,i,s,r,n){const a=this._key[1];let o,l,u,d=e^a[0],h=s^a[1],c=i^a[2],p=t^a[3];const m=a.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(g=0;g<m;g++)o=_[d>>>24]^b[h>>16&255]^v[c>>8&255]^T[255&p]^a[f],l=_[h>>>24]^b[c>>16&255]^v[p>>8&255]^T[255&d]^a[f+1],u=_[c>>>24]^b[p>>16&255]^v[d>>8&255]^T[255&h]^a[f+2],p=_[p>>>24]^b[d>>16&255]^v[h>>8&255]^T[255&c]^a[f+3],f+=4,d=o,h=l,c=u;for(g=0;g<4;g++)r[(3&-g)+n]=S[d>>>24]<<24^S[h>>16&255]<<16^S[c>>8&255]<<8^S[255&p]^a[f++],o=d,d=h,h=c,c=p,p=o}}class n extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},o=function(e,t,i){const s=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new r(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),l=new Int32Array(o.buffer);let u,d,h,c,p,m,g,f,y;for(u=i[0],d=i[1],h=i[2],c=i[3],y=0;y<s.length;y+=4)p=a(s[y]),m=a(s[y+1]),g=a(s[y+2]),f=a(s[y+3]),n.decrypt(p,m,g,f,l,y),l[y]=a(l[y]^u),l[y+1]=a(l[y+1]^d),l[y+2]=a(l[y+2]^h),l[y+3]=a(l[y+3]^c),u=p,d=m,h=g,c=f;return o};class l{constructor(e,i,s,r){const o=l.STEP,u=new Int32Array(e.buffer),d=new Uint8Array(e.byteLength);let h=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(u.subarray(h,h+o),i,s,d)),h=o;h<u.length;h+=o)s=new Uint32Array([a(u[h-4]),a(u[h-3]),a(u[h-2]),a(u[h-1])]),this.asyncStream_.push(this.decryptChunk_(u.subarray(h,h+o),i,s,d));this.asyncStream_.push((function(){r(null,t(d))}))}static get STEP(){return 32e3}decryptChunk_(e,t,i,s){return function(){const r=o(e,t,i);s.set(r,e.byteOffset)}}}var u,d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};u="undefined"!=typeof window?window:void 0!==d?d:"undefined"!=typeof self?self:{};var h=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},c=u.BigInt||Number;c("0x1"),c("0x100"),c("0x10000"),c("0x1000000"),c("0x100000000"),c("0x10000000000"),c("0x1000000000000"),c("0x100000000000000"),c("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();const p=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];h(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t};self.onmessage=function(e){const t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),s=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new l(i,s,r,(function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])}))}})));var zg=em(Gg);const Xg=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Kg=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Yg=(e,t)=>{t.activePlaylistLoader=e,e.load()},Qg=(e,t)=>()=>{const{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:r}}=t,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;a&&l&&a.id===l.id||(r.lastGroup_=a,r.lastTrack_=n,Kg(i,r),a&&!a.isMainPlaylist&&(a.playlistLoader?(i.resyncLoader(),Yg(a.playlistLoader,r)):o&&s.resetEverything()))},Jg=(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()},Zg=(e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:r},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Kg(s,n),o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;const e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;return n.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),i.pause(),r.resetEverything(),void e.fastQualityChange_(s)}if("AUDIO"===e){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l!==o.playlistLoader?(s.track&&s.track(a),s.resetEverything(),Yg(o.playlistLoader,n)):Yg(o.playlistLoader,n)}},ef={AUDIO:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s},excludePlaylist:r}=t;Kg(i,s);const n=s.activeTrack(),a=s.activeGroup(),o=(a.filter((e=>e.default))[0]||a[0]).id,l=s.tracks[o];if(n!==l){ic.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in s.tracks)s.tracks[e].enabled=s.tracks[e]===l;s.onTrackChanged()}else r({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;ic.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Kg(i,s);const r=s.activeTrack();r&&(r.mode="disabled"),s.onTrackChanged()}},tf={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ef[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ef[e](e,i))}},sf={AUDIO:(e,t)=>{const{vhs:i,sourceType:s,segmentLoaders:{[e]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:d}=t,h=Gc(d.main);a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}},h&&(a[e].main.default.playlists=d.main.playlists));for(const c in a[e]){o[c]||(o[c]=[]);for(const r in a[e][c]){let p,m=a[e][c][r];if(h?(u(`AUDIO group '${c}' label '${r}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new pp(m.playlists[0],i,n):m.resolvedUri?new pp(m.resolvedUri,i,n):m.playlists&&"dash"===s?new Kp(m.playlists[0],i,n,d):null,m=cc({id:r,playlistLoader:p},m),tf[e](e,m.playlistLoader,t),o[c].push(m),void 0===l[r]){const e=new ic.AudioTrack({id:r,kind:Xg(m),enabled:!1,language:m.language,default:m.default,label:r});l[r]=e}}}r.on("error",ef[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:s,sourceType:r,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:d}=t;for(const h in o[e]){l[h]||(l[h]=[]);for(const n in o[e][h]){if(o[e][h][n].forced)continue;let c,p=o[e][h][n];if("hls"===r)c=new pp(p.resolvedUri,s,a);else if("dash"===r){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new Kp(p.playlists[0],s,a,d)}else"vhs-json"===r&&(c=new pp(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=cc({id:n,playlistLoader:c},p),tf[e](e,p.playlistLoader,t),l[h].push(p),void 0===u[n]){const e=i.addRemoteTextTrack({id:n,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:n},!1).track;u[n]=e}}}n.on("error",ef[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const a in s[e]){r[a]||(r[a]=[]);for(const t in s[e][a]){const o=s[e][a][t];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const l=i.options_.vhs&&i.options_.vhs.captionServices||{};let u={label:t,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[u.instreamId]&&(u=cc(u,l[u.instreamId])),void 0===u.default&&delete u.default,r[a].push(cc({id:t},o)),void 0===n[t]){const e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[t]=e}}}}},rf=(e,t)=>{for(let i=0;i<e.length;i++){if(Hc(t,e[i]))return!0;if(e[i].playlists&&rf(e[i].playlists,t))return!0}return!1},nf=(e,t)=>i=>{const{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:r}}}=t,n=s.media();if(!n)return null;let a=null;n.attributes[e]&&(a=r[n.attributes[e]]);const o=Object.keys(r);if(!a)if("AUDIO"===e&&o.length>1&&Gc(t.main))for(let e=0;e<o.length;e++){const t=r[o[e]];if(rf(t,n)){a=t;break}}else r.main?a=r.main:1===o.length&&(a=r[o[0]]);return void 0===i?a:null!==i&&a&&a.filter((e=>e.id===i.id))[0]||null},af={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},of=(e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null},lf=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{sf[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=nf(i,e),t[i].activeTrack=af[i](i,e),t[i].onGroupChanged=Qg(i,e),t[i].onGroupChanging=Jg(i,e),t[i].onTrackChanged=Zg(i,e),t[i].getActiveGroup=of(i,e)}));const o=t.AUDIO.activeGroup();if(o){const e=(o.filter((e=>e.default))[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged();t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio");for(const u in t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[u])},uf=()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:wg,activeTrack:wg,getActiveGroup:wg,onGroupChanged:wg,onTrackChanged:wg,lastTrack_:null,logger_:hc(`MediaGroups[${t}]`)}})),e},df=120;let hf;const cf=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],pf=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},mf=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!s)return ic.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(s.id===e.id)return!1;const d=Boolean(yc(t,i).length);if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${u} as current playlist is live`),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const h=Cc(t,i),c=o?Yp.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Yp.MAX_BUFFER_LOW_WATER_LINE;if(a<c)return l(`${u} as duration < max low water line (${a} < ${c})`),!0;const p=s.attributes.BANDWIDTH,m=e.attributes.BANDWIDTH;if(p<m&&(!o||h<n)){let e=`${u} as next bandwidth < current bandwidth (${p} < ${m})`;return o&&(e+=` and forwardBuffer < bufferHighWaterLine (${h} < ${n})`),l(e),!0}if((!o||p>m)&&h>=r){let e=`${u} as forwardBuffer >= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${u} as no switching criteria met`),!1};class gf extends ic.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:s,bandwidth:r,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:u,cacheEncryptionKeys:d,bufferBasedABR:h,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:m}=e;null==m&&(m=1/0),hf=n,this.bufferBasedABR=Boolean(h),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.sourceType_=u,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=uf(),this.mediaSource=new g.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=pc(),this.hasPlayed_=!1,this.syncController_=new Hg(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new zg,this.sourceUpdater_=new Rg(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Wg;const f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings};this.mainPlaylistLoader_="dash"===this.sourceType_?new Kp(t,this.vhs_,this.requestOptions_):new pp(t,this.vhs_,this.requestOptions_),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Eg(cc(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Eg(cc(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Fg(cc(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){s.off("vttjserror",r),e()}function r(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",r),s.addWebVttScript_()}))}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),cf.forEach((e=>{this[e+"_"]=pf.bind(this,e)})),this.logger_=hc("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),r=s&&(s.id||s.uri),n=e.id||e.uri;r&&r!==n&&(this.logger_(`switch media ${r} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=g.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(g.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||s.length&&i[s[0]];for(const t in e)if(e[t].default){r={label:t};break}}if(!r)return t;const n=[];for(const a in i)if(i[a][r.label]){const t=i[a][r.label];if(t.playlists&&t.playlists.length)n.push.apply(n,t.playlists);else if(t.uri)n.push(t);else if(e.playlists.length)for(let i=0;i<e.playlists.length;i++){const t=e.playlists[i];t.attributes&&t.attributes.AUDIO&&t.attributes.AUDIO===a&&n.push(t)}}return n.length?n:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Vc(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),lf({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial");if(!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Vc(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{const e=this.mainPlaylistLoader_.media();if("playlist-unchanged"===e.lastExcludeReason_)return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let s=!0;const r=Object.keys(i.AUDIO);for(const n in i.AUDIO)for(const e in i.AUDIO[n]){i.AUDIO[n][e].uri||(s=!1)}s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),hf.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),n=this.tech_.buffered();return mf({buffered:n,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:df}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}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()}fastQualityChange_(e=this.selectPlaylist()){e!==this.mainPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((()=>{ic.browser.IE_VERSION||ic.browser.IS_EDGE?this.tech_.setCurrentTime(this.tech_.currentTime()+.04):this.tech_.setCurrentTime(this.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList){const e=this.seekable();if(!e.length)return!1;if(ic.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(()=>{this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0)),this.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0))}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(e=>{}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=hf.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-s<=gc;const n=r.end(r.length-1);return n-s<=gc&&i-n<=gc}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,r=s.filter(jc),n=1===r.length&&r[0]===e;if(1===s.length&&i!==1/0)return ic.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let t=!1;s.forEach((i=>{if(i===e)return;const s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(ic.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const l=t.internal?this.logger_:ic.log.warn,u=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${u} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const d=o.targetDuration/2*1e3||5e3,h="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",n||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);const r=[];(s||"audio"===e)&&r.push("AUDIO"),(s||"subtitle"===e)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const s=this[`${t}SegmentLoader_`];!s||e!==t&&"all"!==e||i.push(s)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=yc(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:hf.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const s=this.mainPlaylistLoader_.main,r=hf.Playlist.seekable(t,i,hf.Playlist.liveEdgeDelay(s,t));if(0===r.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=hf.Playlist.seekable(t,i,hf.Playlist.liveEdgeDelay(s,t)),0===e.length)return}let n,a;this.seekable_&&this.seekable_.length&&(n=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=pc([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===n&&this.seekable_.start(0)===a||(this.logger_(`seekable updated [${Tc(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){const e=this.seekable();if(!e.length)return;return void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1)))}const t=this.tech_.buffered();let i=hf.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Bm(this.main(),t),s={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||_t),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||yt}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||yt,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const n=(e,t)=>e?gt(t):ft(t),a={};let o;if(["video","audio"].forEach((function(t){if(s.hasOwnProperty(t)&&!n(e[t].isFmp4,s[t])){const i=e[t].isFmp4?"browser":"muxer";a[i]=a[i]||[],a[i].push(s[t]),"audio"===t&&(o=i)}})),r&&o&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${o} does not support codec(s): "${s.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(dt(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(dt(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}{const e=Object.keys(a).reduce(((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);const r=Bm(this.main,s),n=[];!r.audio||ft(r.audio)||gt(r.audio)||n.push(`audio codec ${r.audio}`),!r.video||ft(r.video)||gt(r.video)||n.push(`video codec ${r.video}`),r.text&&"stpp.ttml.im1t"===r.text&&n.push(`text codec ${r.text}`),n.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${n.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=Mm(dt(e)),r=Um(s),n=s.video&&dt(s.video)[0]||null,a=s.audio&&dt(s.audio)[0]||null;Object.keys(i).forEach((e=>{const s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);const o=[],l=Bm(this.mainPlaylistLoader_.main,s),u=Um(l);if(l.audio||l.video){if(u!==r&&o.push(`codec count "${u}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const e=l.video&&dt(l.video)[0]||null,t=l.audio&&dt(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),qg(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Yp.GOAL_BUFFER_LENGTH,i=Yp.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Yp.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Yp.BUFFER_LOW_WATER_LINE,i=Yp.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Yp.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Yp.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return Yp.BUFFER_HIGH_WATER_LINE}}const ff=(e,t,i)=>s=>{const r=e.main.playlists[t],n=Fc(r),a=jc(r);return void 0===s?a:(s?delete r.disabled:r.disabled=!0,s===a||n||(i(),s?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),s)};class yf{constructor(e,t,i){const{playlistController_:s}=e,r=s.fastQualityChange_.bind(s);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Bm(s.main(),t),this.playlist=t,this.id=i,this.enabled=ff(e.playlists,t.id,r)}}const _f=function(e){e.representations=()=>{const t=e.playlistController_.main(),i=Gc(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!Fc(e))).map(((t,i)=>new yf(e,t,t.id))):[]}},bf=["seeking","seeked","pause","playing","error"];class vf{constructor(e){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.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=hc("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const l=e=>{["main","audio"].forEach((t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(bf,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(bf,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach((e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&g.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&g.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=g.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),r=wc(this[`${e}Buffered_`],s);this[`${e}Buffered_`]=s,r?this.resetSegmentDownloads_(e):(this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:Ec(s)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+gc>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){i=e.end(e.length-1)}if(this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:gc)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Tc(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const s=this.playlistController_.sourceUpdater_,r=this.tech_.buffered(),n=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-mc),u=[n,a];for(let h=0;h<u.length;h++){if(!u[h])continue;if(Cc(u[h],t)<l)return!1}const d=_c(r,t);return 0!==d.length&&(i=d.start(0)+gc,this.logger_(`Buffered region starts (${d.start(0)}) just beyond seek point (${t}). Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=yc(t,e);return i.length&&e+3<=i.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const r=_c(s,t);return r.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+gc;return!i.endList&&s&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const r=yc(e,i-3),n=yc(e,i),a=yc(t,i);a.length&&!n.length&&r.length&&(s={start:r.end(0),end:a.end(0)})}else{_c(e,i).length||(s=this.gapFromVideoUnderflow_(e,i))}return!!s&&(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0)}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=_c(t,i);this.resetTimeUpdate_(),0!==s.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+mc),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){const i=bc(e);for(let s=0;s<i.length;s++){const e=i.start(s),r=i.end(s);if(t-e<4&&t-e>2)return{start:e,end:r}}return null}}const Tf={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Sf=function(e,t){let i=0,s=0;const r=cc(Tf,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const n=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*r.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(r.getSource&&"function"==typeof r.getSource)return i=Date.now(),r.getSource.call(e,a);ic.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)},u=function(t){l(),Sf(e,t)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=u},Ef=function(e){Sf(this,e)};var wf="3.0.2",kf="6.3.0",Cf="1.0.1",xf="6.0.0",If="4.0.1";const Af={PlaylistLoader:pp,Playlist:zc,utils:Ip,STANDARD_PLAYLIST_SELECTOR:Gm,INITIAL_PLAYLIST_SELECTOR:Km,lastBandwidthSelector:Gm,movingAverageBandwidthSelector:zm,comparePlaylistBandwidth:Vm,comparePlaylistResolution:Hm,xhr:fp()};Object.keys(Yp).forEach((e=>{Object.defineProperty(Af,e,{get:()=>(ic.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Yp[e]),set(t){ic.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?ic.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Yp[e]=t}})}));const Df="videojs-vhs",Lf=function(e,t){const i=t.media();let s=-1;for(let r=0;r<e.length;r++)if(e[r].id===i.id){s=r;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})},Pf=function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Lf(e,t.playlists)};Af.canPlaySource=function(){return ic.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Of=(e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Mm(dt(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);const r=mt(s.video),n=mt(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return cc(e,a)},Nf=(e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const s=t.reduce(((e,t)=>{const s=i.contentProtection[t];return s&&s.pssh&&(e[t]={pssh:s.pssh}),e}),{});return Object.keys(s).length&&e.push(s),e}),[]),Rf=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const r=i?s.concat([i]):s,n=Nf(r,Object.keys(t)),a=[],o=[];return n.forEach((t=>{o.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),a.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(a),Promise.race(o)])},Mf=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{const r=Of(t,i,s);return!!r&&(e.currentSource().keySystems=r,!(r&&!e.eme)||(ic.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Uf=()=>{if(!g.localStorage)return null;const e=g.localStorage.getItem(Df);if(!e)return null;try{return JSON.parse(e)}catch(Gf){return null}},Bf=e=>{if(!g.localStorage)return!1;let t=Uf();t=t?cc(t,e):e;try{g.localStorage.setItem(Df,JSON.stringify(t))}catch(Gf){return!1}return t},Ff=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e;Af.supportsNativeHls=function(){if(!S||!S.createElement)return!1;const e=S.createElement("video");if(!ic.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),Af.supportsNativeDash=!!(S&&S.createElement&&ic.getTech("Html5").isSupported())&&/maybe|probably/i.test(S.createElement("video").canPlayType("application/dash+xml")),Af.supportsTypeNatively=e=>"hls"===e?Af.supportsNativeHls:"dash"===e&&Af.supportsNativeDash,Af.isSupported=function(){return ic.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const jf=ic.getComponent("Component");class qf extends jf{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=hc("VhsHandler"),t.options_&&t.options_.playerId){const e=ic.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(S,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=S.fullscreenElement||S.webkitFullscreenElement||S.mozFullScreenElement||S.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=Uf();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Yp.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Yp.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=Ff(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Af,this.options_.sourceType=Tt(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new gf(this.options_);const i=cc({liveRangeSafeTimeDelta:gc},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vf(i),this.playlistController_.on("error",(()=>{const e=ic.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const s=this.options_.bufferBasedABR?Af.movingAverageBandwidthSelector(.55):Af.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=Af.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=g.navigator.connection||g.navigator.mozConnection||g.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const s=1e3*t.downlink*1e3;e=s>=i&&e>=i?Math.max(e,s):s}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;t=this.throughput>0?1/this.throughput:0;return Math.floor(1/(e+t))},set(){ic.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:()=>Ec(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:()=>Ec(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&&Bf({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{_f(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_=g.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Rf({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=Mf({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"!==e.status)return;const t=this.playlistController_.main();if(!t||!t.playlists)return;const i=[];t.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,i.push(e))})),i.length&&(ic.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...i),this.playlistController_.fastQualityChange_())})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==ic.browser.IE_VERSION&&t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=ic.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{Pf(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Lf(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":wf,"mux.js":kf,"mpd-parser":Cf,"m3u8-parser":xf,"aes-decrypter":If}}version(){return this.constructor.version()}canChangeType(){return Rg.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_&&g.URL.revokeObjectURL&&(g.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Mp({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Up({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}const $f={name:"videojs-http-streaming",VERSION:wf,canHandleSource(e,t={}){const i=cc(ic.options,t);return $f.canPlayType(e.type,i)},handleSource(e,t,i={}){const s=cc(ic.options,i);return t.vhs=new qf(e,t,s),t.vhs.xhr=fp(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=Tt(e);if(!i)return"";const s=$f.getOverrideNative(t);return!Af.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(ic.browser.IS_ANY_SAFARI||ic.browser.IS_IOS),{overrideNative:s=i}=t;return s}};(()=>gt("avc1.4d400d,mp4a.40.2"))()&&ic.getTech("Html5").registerSourceHandler($f,0),ic.VhsHandler=qf,ic.VhsSourceHandler=$f,ic.Vhs=Af,ic.use||ic.registerComponent("Vhs",Af),ic.options.vhs=ic.options.vhs||{},ic.getPlugin&&ic.getPlugin("reloadSourceOnError")||ic.registerPlugin("reloadSourceOnError",Ef);const Vf="application/x-mpegURL";let Hf=class extends t{constructor(){super(),this._defaultConfigs={autoplay:!1,fluid:!1,fullscreen:!1,loop:!1,muted:!1,preload:"auto",responsive:!1,startTime:0},this.cameraSensorModel=null,this.currentMetadata=null,this.element=null,this.state="not-ready",this.waitingTimestamp=null,this._initController=()=>{!this._controller&&this.sourceUrl&&(this.element=document.createElement("video"),this._controller=ic(this.element,this._defaultConfigs),this._controller.muted(this.muted),this._controller.loop(this.loop),this._controller.playbackRate(this.rate),this.addHandles([this._controller.ready(this._handleReady),this._controller.on("canplay",this._handleCanPlay),this._controller.on("durationchange",this._handleDurationChange),this._controller.on("ended",this._handleEnded),this._controller.on("error",this._handleError),this._controller.on("loadeddata",this._handleDataLoaded),this._controller.on("loadedmetadata",this._handleLoadedMetadata),this._controller.on("loadstart",this._handleLoadStart),this._controller.on("play",this._handlePlay),this._controller.on("timeupdate",this._handleTimeUpdate),this._controller.on("waiting",this._handleWaiting)]))},this._handleReady=()=>{this.state="ready"},this._handleCanPlay=()=>this.state="can-play",this._handleCueChange=()=>{if(!this.subtitleTrack?.activeCues?.length)return;const e=this.subtitleTrack?.activeCues[0],t=e.text?JSON.parse(e.text):null,i=t?.Data[0]?.Value;if(!i.length)return;const s=new Map;for(const r of i){if(Array.isArray(r.Value)){r.Value.forEach((e=>{s.set(e.TagUID,e)}))}else s.set(r.TagUID,r)}s.set(d.EsriVideoWidth,{Name:"Video Width",TagUID:d.EsriVideoWidth,Value:this._controller.videoWidth()}),s.set(d.EsriVideoHeight,{Name:"Video Height",TagUID:d.EsriVideoHeight,Value:this._controller.videoHeight()}),this.currentMetadata=new Map(s),this.cameraSensorModel=new u({videoMetadata:this.currentMetadata})},this._handleDataLoaded=()=>{},this._handleDurationChange=()=>this.notifyChange("duration"),this._handleEnded=()=>{if(!this.loop)return this._set("ended",!0),this.notifyChange("buffered"),this.notifyChange("currentTime"),this.notifyChange("duration"),this.notifyChange("waiting"),void(this.state="can-play");this.setCurrentTime(0),this.play()},this._handleError=()=>{i.getLogger(this).error("video stream error ::",this._controller?.error())},this._handleLoadStart=()=>{this.state="can-play"},this._handleLoadedMetadata=()=>{this.notifyChange("subtitleTrack"),this.notifyChange("buffered")},this._handlePlay=()=>this.notifyChange("ended"),this._handleTimeUpdate=()=>{this.notifyChange("currentTime"),this.notifyChange("buffered"),this.notifyChange("bufferedPercent")},this._handleWaiting=()=>this.waitingTimestamp=this._controller?.currentTime()}initialize(){this.addHandles([r((()=>this.sourceUrl),(e=>{e&&(this._initController(),this._controller.src({type:Vf,src:this.sourceUrl}))}),n),r((()=>this.subtitleTrack),(()=>{this.subtitleTrack&&(this.subtitleTrack.mode="showing")}))]),this.addHandles(a((()=>this.subtitleTrack),"cuechange",this._handleCueChange))}destroy(){this._controller&&this._controller.dispose()}get buffered(){return this._controller?.bufferedEnd()??0}get bufferedPercent(){return this._controller?.bufferedPercent()??0}get currentTime(){return this._controller?.currentTime()??0}get duration(){return this._controller?.duration()??0}get ended(){return this._controller?.ended()??this._get("ended")??!0}set ended(e){this._controller?.ended(e),this._set("ended",e)}get loop(){return this._controller?.loop()??this._get("loop")??!1}set loop(e){this._controller?.loop(e),this._set("loop",e)}get muted(){return this._controller?.muted()??this._get("muted")??!1}set muted(e){this._controller?.muted(e),this._set("muted",e)}get rate(){return this._controller?.playbackRate()??this._get("rate")??1}set rate(e){this._controller?.playbackRate(e),this._set("rate",e)}get sourceUrl(){return this._controller?.src()}set sourceUrl(e){this._set("sourceUrl",e)}get started(){return this._controller?.hasStarted()}get subtitleTrack(){const e=this._controller?.textTracks();return e?.length?Array.from(e).find((e=>"subtitles"===e.kind)):null}get waiting(){return!this.waitingTimestamp&&(this.waitingTimestamp===this.currentTime||(this.waitingTimestamp=null,!1))}pause(){this._controller?.pause(),this.state="paused"}play(){this._controller?.play(),this.state="playing"}reset(){this._controller&&(this.pause(),this.setCurrentTime(0),this._set("ended",!0))}setCurrentTime(e){const t=s(e,0,this.duration);this._controller?.currentTime(t),this.notifyChange("currentTime")}};e([o()],Hf.prototype,"buffered",null),e([o()],Hf.prototype,"bufferedPercent",null),e([o()],Hf.prototype,"cameraSensorModel",void 0),e([o({readOnly:!0})],Hf.prototype,"currentTime",null),e([o()],Hf.prototype,"currentMetadata",void 0),e([o({readOnly:!0})],Hf.prototype,"duration",null),e([o()],Hf.prototype,"element",void 0),e([o({readOnly:!0})],Hf.prototype,"ended",null),e([o()],Hf.prototype,"loop",null),e([o()],Hf.prototype,"muted",null),e([o()],Hf.prototype,"rate",null),e([o()],Hf.prototype,"sourceUrl",null),e([o({readOnly:!0})],Hf.prototype,"started",null),e([o()],Hf.prototype,"state",void 0),e([o()],Hf.prototype,"subtitleTrack",null),e([o({readOnly:!0})],Hf.prototype,"waiting",null),e([o()],Hf.prototype,"waitingTimestamp",void 0),Hf=e([l("esri.layers.video.VideoController")],Hf);const Wf=Hf;export{Wf as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{watch as r,initial as n,on as a}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import u from"./VideoCameraSensorModel.js";import{VideoMetadataEntryId as d}from"./videoUtils.js";import{g as h,c,a as p}from"../../chunks/_commonjsHelpers.js";var m="undefined"!=typeof window?window:void 0!==c?c:"undefined"!=typeof self?self:{};const g=h(m);var f=require("./document.js");module.exports=new f;const y=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var _,b=void 0!==c?c:"undefined"!=typeof window?window:{},v=p(y);"undefined"!=typeof document?_=document:(_=b["__GLOBAL_DOCUMENT_CACHE@4"])||(_=b["__GLOBAL_DOCUMENT_CACHE@4"]=v);var T=_;const S=h(T);var E={exports:{}};E.exports,function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return a[e];var i,n=String(e);return(i=s[n.toLowerCase()])?i:(i=r[n.toLowerCase()])||(1===n.length?n.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var n;if(n=s[t.toLowerCase()])return n===i;if(n=r[t.toLowerCase()])return n===i}else if("number"==typeof t)return t===i;return!1}};var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a=t.names=t.title={};for(n in s)a[s[n]]=n;for(var o in r)s[o]=r[o]}(E,E.exports);const w=h(E.exports);function k(e,t){var i,s=null;try{i=JSON.parse(e,t)}catch(r){s=r}return[s,i]}const C=h(k);var x={exports:{}};function I(){return module.exports=I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},module.exports.__esModule=!0,module.exports.default=module.exports,I.apply(this,arguments)}module.exports=I,module.exports.__esModule=!0,module.exports.default=module.exports;const A=p(Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})));module.exports=L;var D=Object.prototype.toString;function L(e){if(!e)return!1;var t=D.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}const P=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var O=m;function N(e){return void 0===e&&(e=""),e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),s=i[0],r=i[1];return"charset"===s.trim()?r.trim():e}),"utf-8")}var R=function(e,t){return void 0===t&&(t=!1),function(i,s,r){if(i)e(i);else if(s.statusCode>=400&&s.statusCode<=599){var n=r;if(t)if(O.TextDecoder){var a=N(s.headers&&s.headers["content-type"]);try{n=new TextDecoder(a).decode(r)}catch(o){}}else n=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:n})}else e(null,r)}},M=m,U=A,B=p(P);V.httpHandler=R;var F=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),s=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[s]?t[s]=r:Array.isArray(t[s])?t[s].push(r):t[s]=[t[s],r]})),t):t};function j(e,t){for(var i=0;i<e.length;i++)t(e[i])}function q(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function $(e,t,i){var s=e;return B(t)?(i=t,"string"==typeof e&&(s={uri:e})):s=U({},t,{uri:e}),s.callback=i,s}function V(e,t,i){return H(t=$(e,t,i))}function H(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,s,r){t||(t=!0,e.callback(i,s,r))};function s(){4===u.readyState&&setTimeout(a,0)}function r(){var e=void 0;if(e=u.response?u.response:u.responseText||W(u),f)try{e=JSON.parse(e)}catch(t){}return e}function n(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,y)}function a(){if(!l){var t;clearTimeout(d),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var s=y,n=null;return 0!==t?(s={body:r(),statusCode:t,method:c,headers:{},url:h,rawRequest:u},u.getAllResponseHeaders&&(s.headers=F(u.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),i(n,s,s.body)}}var o,l,u=e.xhr||null;u||(u=e.cors||e.useXDR?new V.XDomainRequest:new V.XMLHttpRequest);var d,h=u.url=e.uri||e.url,c=u.method=e.method||"GET",p=e.body||e.data,m=u.headers=e.headers||{},g=!!e.sync,f=!1,y={body:void 0,headers:{},statusCode:0,method:c,url:h,rawRequest:u};if("json"in e&&!1!==e.json&&(f=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),u.onreadystatechange=s,u.onload=a,u.onerror=n,u.onprogress=function(){},u.onabort=function(){l=!0},u.ontimeout=n,u.open(c,h,!g,e.username,e.password),g||(u.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(d=setTimeout((function(){if(!l){l=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),u.setRequestHeader)for(o in m)m.hasOwnProperty(o)&&u.setRequestHeader(o,m[o]);else if(e.headers&&!q(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(p||null),u}function W(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(i){}return null}function G(){}x.exports=V,x.exports.default=V,V.XMLHttpRequest=M.XMLHttpRequest||G,V.XDomainRequest="withCredentials"in new V.XMLHttpRequest?V.XMLHttpRequest:M.XDomainRequest,j(["get","put","post","patch","head","delete"],(function(e){V["delete"===e?"del":e]=function(t,i,s){return(i=$(t,i,s)).method=e.toUpperCase(),H(i)}}));const z=h(x.exports);var X={exports:{}},K=T,Y=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function Q(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function J(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+(0|s)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Z(){this.values=Y(null)}function ee(e,t,i,s){var r=s?e.split(s):[e];for(var n in r)if("string"==typeof r[n]){var a=r[n].split(i);if(2===a.length)t(a[0].trim(),a[1].trim())}}function te(e,t,i){var s=e;function r(){var t=J(e);if(null===t)throw new Q(Q.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(e,t){var s=new Z;ee(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),a=n[0];s.integer(e,a),s.percent(e,a)&&s.set("snapToLines",!1),s.alt(e,a,["auto"]),2===n.length&&s.alt("lineAlign",n[1],["start","center","end"]);break;case"position":n=t.split(","),s.percent(e,n[0]),2===n.length&&s.alt("positionAlign",n[1],["start","center","end"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");try{t.line=s.get("line","auto")}catch(r){}t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100);try{t.align=s.get("align","center")}catch(r){t.align=s.get("align","middle")}try{t.position=s.get("position","auto")}catch(r){t.position=s.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=s.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Q(Q.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.substr(3),a(),t.endTime=r(),a(),n(e,t)}Q.prototype=Y(Error.prototype),Q.prototype.constructor=Q,Q.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Z.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ie=K.createElement&&K.createElement("textarea"),se={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},re={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)"},ne={v:"title",lang:"lang"},ae={rt:"ruby"};function oe(e,t){function i(){if(!t)return null;function e(e){return t=t.substr(e.length),e}var i=t.match(/^([^<]*)(<[^>]*>?)?/);return e(i[1]?i[1]:i[2])}function s(e){return ie.innerHTML=e,e=ie.textContent,ie.textContent="",e}function r(e,t){return!ae[t.localName]||ae[t.localName]===e.localName}function n(t,i){var s=se[t];if(!s)return null;var r=e.document.createElement(s),n=ne[t];return n&&i&&(r[n]=i.trim()),r}for(var a,o=e.document.createElement("div"),l=o,u=[];null!==(a=i());)if("<"!==a[0])l.appendChild(e.document.createTextNode(s(a)));else{if("/"===a[1]){u.length&&u[u.length-1]===a.substr(2).replace(">","")&&(u.pop(),l=l.parentNode);continue}var d,h=J(a.substr(1,a.length-2));if(h){d=e.document.createProcessingInstruction("timestamp",h),l.appendChild(d);continue}var c=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!c)continue;if(!(d=n(c[1],c[3])))continue;if(!r(l,d))continue;if(c[2]){var p=c[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(re.hasOwnProperty(i)){var s=t?"background-color":"color",r=re[i];d.style[s]=r}})),d.className=p.join(" ")}u.push(c[1]),l.appendChild(d),l=d}return o}var le=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function ue(e){for(var t=0;t<le.length;t++){var i=le[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function de(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function s(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var n=i.match(/^.*(\n|\r)/);return n?(e.length=0,n[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(s(e,t),r(e)):void 0}for(s(t,e);i=r(t);)for(var n=0;n<i.length;n++)if(ue(i.charCodeAt(n)))return"rtl";return"ltr"}function he(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&s++;return-1*++s}function ce(){}function pe(e,t,i){ce.call(this),this.cue=t,this.cueDiv=oe(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:de(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function me(e){var t,i,s,r;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,r=e.div.offsetTop;var n=(n=e.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();e=e.div.getBoundingClientRect(),t=n?Math.max(n[0]&&n[0].height||0,e.height/n.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||s,this.lineHeight=void 0!==t?t:e.lineHeight}function ge(e,t,i,s){function r(e,t){for(var r,n=new me(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(s);)e.move(t[o]);if(e.within(i))return e;var l=e.intersectPercentage(i);a>l&&(r=new me(e),a=l),e=new me(n)}return r||n}var n=new me(t),a=t.cue,o=he(a),l=[];if(a.snapToLines){var u;switch(a.vertical){case"":l=["+y","-y"],u="height";break;case"rl":l=["+x","-x"],u="width";break;case"lr":l=["-x","+x"],u="width"}var d=n.lineHeight,h=d*Math.round(o),c=i[u]+d,p=l[0];Math.abs(h)>c&&(h=h<0?-1:1,h*=Math.ceil(c/d)*d),o<0&&(h+=""===a.vertical?i.height:i.width,l=l.reverse()),n.move(p,h)}else{var m=n.lineHeight/i.height*100;switch(a.lineAlign){case"center":o-=m/2;break;case"end":o-=m}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")})}l=["+y","-x","+x","-y"],n=new me(t)}var g=r(n,l);t.move(g.toCSSCompatValues(i))}function fe(){}ce.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},ce.prototype.formatStyle=function(e,t){return 0===e?0:e+t},pe.prototype=Y(ce.prototype),pe.prototype.constructor=pe,me.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},me.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},me.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},me.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},me.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},me.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},me.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},me.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},fe.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},fe.convertCueToDOMTree=function(e,t){return e&&t?oe(e,t):null};var ye=.05,_e="sans-serif",be="1.5%";fe.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");function r(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin=be,i.appendChild(s),r(t)){var n=[],a=me.getSimpleBoxPosition(s),o={font:Math.round(a.height*ye*100)/100+"px "+_e};!function(){for(var i,r,l=0;l<t.length;l++)r=t[l],i=new pe(e,r,o),s.appendChild(i.div),ge(e,i,a,n),r.displayState=i.div,n.push(me.getSimpleBoxPosition(i))}()}else for(var l=0;l<t.length;l++)s.appendChild(t[l].displayState)},fe.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},fe.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof Q))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var s=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),s}function s(e){var i=new Z;if(ee(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var s=t.split(",");if(2!==s.length)break;var r=new Z;if(r.percent("x",s[0]),r.percent("y",s[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var s=new(t.vttjs.VTTRegion||t.window.VTTRegion);s.width=i.get("width",100),s.lines=i.get("lines",3),s.regionAnchorX=i.get("regionanchorX",0),s.regionAnchorY=i.get("regionanchorY",100),s.viewportAnchorX=i.get("viewportanchorX",0),s.viewportAnchorY=i.get("viewportanchorY",100),s.scroll=i.get("scroll",""),t.onregion&&t.onregion(s),t.regionList.push({id:i.get("id"),region:s})}}function r(e){var i=new Z;ee(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",J(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}function n(e){e.match(/X-TIMESTAMP-MAP/)?ee(e,(function(e,t){if("X-TIMESTAMP-MAP"===e)r(t)}),/=/):ee(e,(function(e,t){if("Region"===e)s(t)}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var a;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var o=(a=i()).match(/^WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new Q(Q.Errors.BadSignature);t.state="HEADER"}for(var l=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(l?l=!1:a=i(),t.state){case"HEADER":/:/.test(a)?n(a):a||(t.state="ID");continue;case"NOTE":a||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){t.state="NOTE";break}if(!a)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(d){t.cue.align="middle"}if(t.state="CUE",-1===a.indexOf("--\x3e")){t.cue.id=a;continue}case"CUE":try{te(a,t.cue,t.regionList)}catch(d){t.reportOrThrowError(d),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var u=-1!==a.indexOf("--\x3e");if(!a||u&&(l=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=a.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":a||(t.state="ID");continue}}}catch(d){t.reportOrThrowError(d),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Q(Q.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var ve=fe,Te="auto",Se={"":1,lr:1,rl:1},Ee={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function we(e){return"string"==typeof e&&(!!Se[e.toLowerCase()]&&e.toLowerCase())}function ke(e){return"string"==typeof e&&(!!Ee[e.toLowerCase()]&&e.toLowerCase())}function Ce(e,t,i){this.hasBeenReset=!1;var s="",r=!1,n=e,a=t,o=i,l=null,u="",d=!0,h="auto",c="start",p="auto",m="auto",g=100,f="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(e){s=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");n=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var t=we(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return d},set:function(e){d=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&e!==Te)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){var t=ke(e);t?(c=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(e){var t=ke(e);t?(m=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");g=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return f},set:function(e){var t=ke(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");f=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ce.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var xe=Ce,Ie={"":!0,up:!0};function Ae(e){return"string"==typeof e&&(!!Ie[e.toLowerCase()]&&e.toLowerCase())}function De(e){return"number"==typeof e&&e>=0&&e<=100}function Le(){var e=100,t=3,i=0,s=100,r=0,n=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!De(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!De(e))throw new Error("RegionAnchorX must be between 0 and 100.");s=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!De(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!De(e))throw new Error("ViewportAnchorY must be between 0 and 100.");n=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!De(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return a},set:function(e){var t=Ae(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):a=t}}})}var Pe=Le,Oe=m,Ne=X.exports={WebVTT:ve,VTTCue:xe,VTTRegion:Pe};Oe.vttjs=Ne,Oe.WebVTT=Ne.WebVTT;var Re=Ne.VTTCue,Me=Ne.VTTRegion,Ue=Oe.VTTCue,Be=Oe.VTTRegion;Ne.shim=function(){Oe.VTTCue=Re,Oe.VTTRegion=Me},Ne.restore=function(){Oe.VTTCue=Ue,Oe.VTTRegion=Be},Oe.VTTCue||Ne.shim();const Fe=h(X.exports);var je={exports:{}};je.exports,function(e,t){!function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var n=a.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return i.alwaysNormalize?(n.path=a.normalizePath(n.path),a.buildURLFromParts(n)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=s.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(u.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,h=d.substring(0,d.lastIndexOf("/")+1)+n.path;u.path=a.normalizePath(h)}else u.path=o.path,n.params||(u.params=o.params,n.query||(u.query=o.query));return null===u.path&&(u.path=i.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=a}()}(je,je.exports);const qe=h(je.exports);var $e="http://example.com",Ve=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=g.location&&g.location.href||"");var i="function"==typeof g.URL,s=/^\/\//.test(e),r=!g.location&&!/\/\//i.test(e);if(i?e=new g.URL(e,g.location||$e):/\/\//i.test(e)||(e=qe.buildAbsoluteURL(g.location&&g.location.href||"",e)),i){var n=new URL(t,e);return r?n.href.slice($e.length):s?n.href.slice(n.protocol.length):n.href}return qe.buildAbsoluteURL(e,t)};function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},He.apply(this,arguments)}var We=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),Ge=function(e){return g.atob?g.atob(e):Buffer.from(e,"base64").toString("binary")};function ze(e){for(var t=Ge(e),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}class Xe extends We{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Ke=String.fromCharCode(9),Ye=function(e){const t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},Qe=function(){return new RegExp("(?:^|,)("+("(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")")+")")},Je=function(e){const t={};if(!e)return t;const i=e.split(Qe());let s,r=i.length;for(;r--;)""!==i[r]&&(s=/([^=]*)=(.*)/.exec(i[r]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),t[s[0]]=s[1]);return t};class Ze extends We{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(0===(e=e.trim()).length)return;if("#"!==e[0])return void this.trigger("data",{type:"uri",uri:e});this.tagMappers.reduce(((t,i)=>{const s=i(e);return s===e?t:t.concat([s])}),[e]).forEach((e=>{for(let t=0;t<this.customParsers.length;t++)if(this.customParsers[t].call(this,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e),t)this.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e),t)return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void this.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e),t)return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void this.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(e),t)return i=He(Ye(t[1]),{type:"tag",tagType:"byterange"}),void this.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e),t)return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-MAP:(.*)$/.exec(e),t){if(i={type:"tag",tagType:"map"},t[1]){const e=Je(t[1]);e.URI&&(i.uri=e.URI),e.BYTERANGE&&(i.byterange=Ye(e.BYTERANGE))}this.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(e),t){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=Je(t[1]),i.attributes.RESOLUTION){const e=i.attributes.RESOLUTION.split("x"),t={};e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),i.attributes.RESOLUTION=t}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}this.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:(.*)$/.exec(e),t)return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Je(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e),t)this.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e),t)this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e),t)return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-KEY:(.*)$/.exec(e),t)return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Je(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void this.trigger("data",i);if(t=/^#EXT-X-START:(.*)$/.exec(e),t)return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Je(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-CUE-IN:(.*)?$/.exec(e),t)return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i);if(t=/^#EXT-X-SKIP:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"skip"},i.attributes=Je(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(Ke)),void this.trigger("data",i);if(t=/^#EXT-X-PART:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"part"},i.attributes=Je(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Ye(i.attributes.BYTERANGE)),void this.trigger("data",i);if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"server-control"},i.attributes=Je(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void this.trigger("data",i);if(t=/^#EXT-X-PART-INF:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"part-inf"},i.attributes=Je(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void this.trigger("data",i);if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"preload-hint"},i.attributes=Je(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){if(i.attributes.hasOwnProperty(e)){i.attributes[e]=parseInt(i.attributes[e],10);const t="BYTERANGE-LENGTH"===e?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e]}})),void this.trigger("data",i);if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e),t&&t[1])return i={type:"tag",tagType:"rendition-report"},i.attributes=Je(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void this.trigger("data",i);if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(e),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=Je(t[1]),["ID","CLASS"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=String(i.attributes[e]))})),["START-DATE","END-DATE"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=new Date(i.attributes[e]))})),["DURATION","PLANNED-DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["END-ON-NEXT"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/i.test(i.attributes[e]))})),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=i.attributes[e].toString(16))}));const e=/^X-([A-Z]+-)+[A-Z]+$/;for(const t in i.attributes){if(!e.test(t))continue;const s=/[0-9A-Fa-f]{6}/g.test(i.attributes[t]),r=/^\d+(\.\d+)?$/.test(i.attributes[t]);i.attributes[t]=s?i.attributes[t].toString(16):r?parseFloat(i.attributes[t]):String(i.attributes[t])}this.trigger("data",i)}else t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e),t?this.trigger("data",{type:"tag",tagType:"independent-segments"}):this.trigger("data",{type:"tag",data:e.slice(4)})}}}else this.trigger("data",{type:"comment",text:e.slice(1)})}))}addParser({expression:e,customType:t,dataParser:i,segment:s}){"function"!=typeof i&&(i=e=>e),this.customParsers.push((r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:s}),!0}))}addTagMapper({expression:e,map:t}){const i=i=>e.test(i)?t(i):i;this.tagMappers.push(i)}}const et=e=>e.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase())),tt=function(e){const t={};return Object.keys(e).forEach((function(i){t[et(i)]=e[i]})),t},it=function(e){const{serverControl:t,targetDuration:i,partTargetDuration:s}=e;if(!t)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=i&&3*i,l=s&&2*s;i&&!t.hasOwnProperty(n)&&(t[n]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[n]<o&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${t[n]}) to targetDuration * 3 (${o})`}),t[n]=o),s&&!t.hasOwnProperty(a)&&(t[a]=3*s,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${t[a]}).`})),s&&t[a]<l&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${t[a]}) to partTargetDuration * 2 (${l}).`}),t[a]=l)};class st extends We{constructor(){super(),this.lineStream=new Xe,this.parseStream=new Ze,this.lineStream.pipe(this.parseStream);const e=this,t=[];let i,s,r={},n=!1;const a=function(){},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let u=0;this.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};let d=0,h=0;const c={};this.on("end",(()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&s&&(r.key=s),r.timeline||"number"!=typeof u||(r.timeline=u),this.manifest.preloadSegment=r)})),this.parseStream.on("data",(function(p){let m,g;({tag(){({version(){p.version&&(this.manifest.version=p.version)},"allow-cache"(){this.manifest.allowCache=p.allowed,"allowed"in p||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const e={};"length"in p&&(r.byterange=e,e.length=p.length,"offset"in p||(p.offset=d)),"offset"in p&&(r.byterange=e,e.offset=p.offset),d=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),p.duration>0&&(r.duration=p.duration),0===p.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(p.attributes)if("NONE"!==p.attributes.METHOD)if(p.attributes.URI){if("com.apple.streamingkeydelivery"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:p.attributes});if("com.microsoft.playready"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:p.attributes.URI});if(p.attributes.KEYFORMAT===l){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(p.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===p.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==p.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):p.attributes.KEYID&&"0x"===p.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:p.attributes.KEYFORMAT,keyId:p.attributes.KEYID.substring(2)},pssh:ze(p.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}p.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:p.attributes.METHOD||"AES-128",uri:p.attributes.URI},void 0!==p.attributes.IV&&(s.iv=p.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else s=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(p.number)?this.manifest.mediaSequence=p.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+p.number})},"discontinuity-sequence"(){isFinite(p.number)?(this.manifest.discontinuitySequence=p.number,u=p.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+p.number})},"playlist-type"(){/VOD|EVENT/.test(p.playlistType)?this.manifest.playlistType=p.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+p.playlist})},map(){i={},p.uri&&(i.uri=p.uri),p.byterange&&(i.byterange=p.byterange),s&&(i.key=s)},"stream-inf"(){this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||o,p.attributes?(r.attributes||(r.attributes={}),He(r.attributes,p.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,!(p.attributes&&p.attributes.TYPE&&p.attributes["GROUP-ID"]&&p.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const e=this.manifest.mediaGroups[p.attributes.TYPE];e[p.attributes["GROUP-ID"]]=e[p.attributes["GROUP-ID"]]||{},m=e[p.attributes["GROUP-ID"]],g={default:/yes/i.test(p.attributes.DEFAULT)},g.default?g.autoselect=!0:g.autoselect=/yes/i.test(p.attributes.AUTOSELECT),p.attributes.LANGUAGE&&(g.language=p.attributes.LANGUAGE),p.attributes.URI&&(g.uri=p.attributes.URI),p.attributes["INSTREAM-ID"]&&(g.instreamId=p.attributes["INSTREAM-ID"]),p.attributes.CHARACTERISTICS&&(g.characteristics=p.attributes.CHARACTERISTICS),p.attributes.FORCED&&(g.forced=/yes/i.test(p.attributes.FORCED)),m[p.attributes.NAME]=g},discontinuity(){u+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=p.dateTimeString,this.manifest.dateTimeObject=p.dateTimeObject),r.dateTimeString=p.dateTimeString,r.dateTimeObject=p.dateTimeObject},targetduration(){!isFinite(p.duration)||p.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+p.duration}):(this.manifest.targetDuration=p.duration,it.call(this,this.manifest))},start(){p.attributes&&!isNaN(p.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:p.attributes["TIME-OFFSET"],precise:p.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){r.cueOut=p.data},"cue-out-cont"(){r.cueOutCont=p.data},"cue-in"(){r.cueIn=p.data},skip(){this.manifest.skip=tt(p.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",p.attributes,["SKIPPED-SEGMENTS"])},part(){n=!0;const e=this.manifest.segments.length,t=tt(p.attributes);r.parts=r.parts||[],r.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=h),h=t.byterange.offset+t.byterange.length);const i=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${e}`,p.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const e=this.manifest.serverControl=tt(p.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),it.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const e=this.manifest.segments.length,t=tt(p.attributes),i=t.type&&"PART"===t.type;r.preloadHints=r.preloadHints||[],r.preloadHints.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?h:0,i&&(h=t.byterange.offset+t.byterange.length)));const s=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #${e}`,p.attributes,["TYPE","URI"]),t.type)for(let n=0;n<r.preloadHints.length-1;n++){const i=r.preloadHints[n];i.type&&(i.type===t.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${s} for segment #${e} has the same TYPE ${t.type} as preload hint #${n}`}))}},"rendition-report"(){const e=tt(p.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(e);const t=this.manifest.renditionReports.length-1,i=["LAST-MSN","URI"];n&&i.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${t}`,p.attributes,i)},"part-inf"(){this.manifest.partInf=tt(p.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",p.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),it.call(this,this.manifest)},daterange(){this.manifest.daterange=this.manifest.daterange||[],this.manifest.daterange.push(tt(p.attributes));const e=this.manifest.daterange.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${e}`,p.attributes,["ID","START-DATE"]);const t=this.manifest.daterange[e];t.endDate&&t.startDate&&new Date(t.endDate)<new Date(t.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),t.duration&&t.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),t.plannedDuration&&t.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const i=!!t.endOnNext;if(i&&!t.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),i&&(t.duration||t.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),t.duration&&t.endDate){const i=t.startDate,s=i.setSeconds(i.getSeconds()+t.duration);this.manifest.daterange[e].endDate=new Date(s)}if(t&&!this.manifest.dateTimeString&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),c[t.id]){for(const s in c[t.id])if(c[t.id][s]!==t[s]){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes and same attribute values"});break}}else c[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0}}[p.tagType]||a).call(e)},uri(){r.uri=p.uri,t.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),s&&(r.key=s),r.timeline=u,i&&(r.map=i),h=0,r={}},comment(){},custom(){p.segment?(r.custom=r.custom||{},r.custom[p.customType]=p.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[p.customType]=p.data)}})[p.type].call(e)}))}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach((function(e){t.hasOwnProperty(e)||s.push(e)})),s.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var rt,nt,at={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},ot=["video","audio","text"],lt=["Video","Audio","Text"],ut=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},dt=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),ot.forEach((function(s){var r=at[s].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=s;var n=e.substring(0,r[1].length),a=e.replace(n,"");i.push({type:n,details:a,mediaType:s})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},ht=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var s in i){var r=i[s];if(r.default&&r.playlists)return dt(r.playlists[0].attributes.CODECS)}return null},ct=function(e){return void 0===e&&(e=""),at.audio.test(e.trim().toLowerCase())},pt=function(e){return void 0===e&&(e=""),at.text.test(e.trim().toLowerCase())},mt=function(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map((function(e){return ut(e.trim())})),i="video";1===t.length&&ct(t[0])?i="audio":1===t.length&&pt(t[0])&&(i="application");var s="mp4";return t.every((function(e){return at.mp4.test(e)}))?s="mp4":t.every((function(e){return at.webm.test(e)}))?s="webm":t.every((function(e){return at.ogg.test(e)}))&&(s="ogg"),i+"/"+s+';codecs="'+e+'"'}},gt=function(e){return void 0===e&&(e=""),g.MediaSource&&g.MediaSource.isTypeSupported&&g.MediaSource.isTypeSupported(mt(e))||!1},ft=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<lt.length;t++){var i=lt[t];if(at["muxer"+i].test(e))return!0}return!1}))},yt="mp4a.40.2",_t="avc1.4d400d",bt=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,vt=/^application\/dash\+xml/i,Tt=function(e){return bt.test(e)?"hls":vt.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},St=function(e){return e.toString(2).length},Et=function(e){return Math.ceil(St(e)/8)},wt=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},kt=function(e){return wt(e)},Ct=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||kt(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},xt=g.BigInt||Number,It=[xt("0x1"),xt("0x100"),xt("0x10000"),xt("0x1000000"),xt("0x100000000"),xt("0x10000000000"),xt("0x1000000000000"),xt("0x100000000000000"),xt("0x10000000000000000")];rt=new Uint16Array([65484]),255===(nt=new Uint8Array(rt.buffer,rt.byteOffset,rt.byteLength))[0]||nt[0];var At=function(e,t){var i=void 0===t?{}:t,s=i.signed,r=void 0!==s&&s,n=i.le,a=void 0!==n&&n;e=Ct(e);var o=a?"reduce":"reduceRight",l=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,s){var r=a?s:Math.abs(s+1-e.length);return t+xt(i)*It[r]}),xt(0));if(r){var u=It[e.length]/xt(2)-xt(1);(l=xt(l))>u&&(l-=u,l-=u,l-=xt(2))}return Number(l)},Dt=function(e,t){var i=(void 0===t?{}:t).le,s=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=xt(e);for(var r=Et(e),n=new Uint8Array(new ArrayBuffer(r)),a=0;a<r;a++){var o=s?a:Math.abs(a+1-n.length);n[o]=Number(e/It[a]&xt(255)),e<0&&(n[o]=Math.abs(~n[o]),n[o]-=0===a?1:2)}return n},Lt=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i},Pt=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e})),t.length<=1)return Ct(t[0]);var s=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(s),n=0;return t.forEach((function(e){e=Ct(e),r.set(e,n),n+=e.byteLength})),r},Ot=function(e,t,i){var s=void 0===i?{}:i,r=s.offset,n=void 0===r?0:r,a=s.mask,o=void 0===a?[]:a;e=Ct(e);var l=(t=Ct(t)).every?t.every:Array.prototype.every;return t.length&&e.length-n>=t.length&&l.call(t,(function(t,i){return t===(o[i]?o[i]&e[n+i]:e[n+i])}))},Nt="http://example.com",Rt=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=g.location&&g.location.href||"");var i="function"==typeof g.URL,s=/^\/\//.test(e),r=!g.location&&!/\/\//i.test(e);if(i?e=new g.URL(e,g.location||Nt):/\/\//i.test(e)||(e=qe.buildAbsoluteURL(g.location&&g.location.href||"",e)),i){var n=new URL(t,e);return r?n.href.slice(Nt.length):s?n.href.slice(n.protocol.length):n.href}return qe.buildAbsoluteURL(e,t)},Mt=function(e,t,i){t.forEach((function(t){for(var s in e.mediaGroups[t])for(var r in e.mediaGroups[t][s]){var n=e.mediaGroups[t][s][r];i(n,t,s,r)}}))},Ut=function(e){return g.atob?g.atob(e):Buffer.from(e,"base64").toString("binary")};function Bt(e){for(var t=Ut(e),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}var Ft={},jt={};function qt(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];if(t.call(void 0,r,s,e))return r}}function $t(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}function Vt(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}var Ht=$t({HTML:"text/html",isHTML:function(e){return e===Ht.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Wt=$t({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Wt.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});jt.assign=Vt,jt.find=qt,jt.freeze=$t,jt.MIME_TYPE=Ht,jt.NAMESPACE=Wt;var Gt=jt,zt=Gt.find,Xt=Gt.NAMESPACE;function Kt(e){return""!==e}function Yt(e){return e?e.split(/[\t\n\f\r ]+/).filter(Kt):[]}function Qt(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Jt(e){if(!e)return[];var t=Yt(e);return Object.keys(t.reduce(Qt,{}))}function Zt(e){return function(t){return e&&-1!==e.indexOf(t)}}function ei(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function ti(e,t){var i=e.prototype;if(!(i instanceof t)){function s(){}s.prototype=t.prototype,ei(i,s=new s),e.prototype=i=s}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var ii={},si=ii.ELEMENT_NODE=1,ri=ii.ATTRIBUTE_NODE=2,ni=ii.TEXT_NODE=3,ai=ii.CDATA_SECTION_NODE=4,oi=ii.ENTITY_REFERENCE_NODE=5,li=ii.ENTITY_NODE=6,ui=ii.PROCESSING_INSTRUCTION_NODE=7,di=ii.COMMENT_NODE=8,hi=ii.DOCUMENT_NODE=9,ci=ii.DOCUMENT_TYPE_NODE=10,pi=ii.DOCUMENT_FRAGMENT_NODE=11,mi=ii.NOTATION_NODE=12,gi={},fi={};gi.INDEX_SIZE_ERR=(fi[1]="Index size error",1),gi.DOMSTRING_SIZE_ERR=(fi[2]="DOMString size error",2);var yi=gi.HIERARCHY_REQUEST_ERR=(fi[3]="Hierarchy request error",3);gi.WRONG_DOCUMENT_ERR=(fi[4]="Wrong document",4),gi.INVALID_CHARACTER_ERR=(fi[5]="Invalid character",5),gi.NO_DATA_ALLOWED_ERR=(fi[6]="No data allowed",6),gi.NO_MODIFICATION_ALLOWED_ERR=(fi[7]="No modification allowed",7);var _i=gi.NOT_FOUND_ERR=(fi[8]="Not found",8);gi.NOT_SUPPORTED_ERR=(fi[9]="Not supported",9);var bi=gi.INUSE_ATTRIBUTE_ERR=(fi[10]="Attribute in use",10);function vi(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,fi[e]),this.message=fi[e],Error.captureStackTrace&&Error.captureStackTrace(this,vi);return i.code=e,t&&(this.message=this.message+": "+t),i}function Ti(){}function Si(e,t){this._node=e,this._refresh=t,Ei(this)}function Ei(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var i=e._refresh(e._node);if(ms(e,"length",i.length),!e.$$length||i.length<e.$$length)for(var s=i.length;s in e;s++)Object.prototype.hasOwnProperty.call(e,s)&&delete e[s];ei(i,e),e._inc=t}}function wi(){}function ki(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function Ci(e,t,i,s){if(s?t[ki(t,s)]=i:t[t.length++]=i,e){i.ownerElement=e;var r=e.ownerDocument;r&&(s&&Ni(r,e,s),Oi(r,e,i))}}function xi(e,t,i){var s=ki(t,i);if(!(s>=0))throw new vi(_i,new Error(e.tagName+"@"+i));for(var r=t.length-1;s<r;)t[s]=t[++s];if(t.length=r,e){var n=e.ownerDocument;n&&(Ni(n,e,i),i.ownerElement=null)}}function Ii(){}function Ai(){}function Di(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Li(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Li(e,t))return!0}while(e=e.nextSibling)}function Pi(){this.ownerDocument=this}function Oi(e,t,i){e&&e._inc++,i.namespaceURI===Xt.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}function Ni(e,t,i,s){e&&e._inc++,i.namespaceURI===Xt.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Ri(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)s[n++]=r,r=r.nextSibling;s.length=n,delete s[s.length]}}}function Mi(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ri(e.ownerDocument,e),t}function Ui(e){return e&&(e.nodeType===Ai.DOCUMENT_NODE||e.nodeType===Ai.DOCUMENT_FRAGMENT_NODE||e.nodeType===Ai.ELEMENT_NODE)}function Bi(e){return e&&(ji(e)||qi(e)||Fi(e)||e.nodeType===Ai.DOCUMENT_FRAGMENT_NODE||e.nodeType===Ai.COMMENT_NODE||e.nodeType===Ai.PROCESSING_INSTRUCTION_NODE)}function Fi(e){return e&&e.nodeType===Ai.DOCUMENT_TYPE_NODE}function ji(e){return e&&e.nodeType===Ai.ELEMENT_NODE}function qi(e){return e&&e.nodeType===Ai.TEXT_NODE}function $i(e,t){var i=e.childNodes||[];if(zt(i,ji)||Fi(t))return!1;var s=zt(i,Fi);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function Vi(e,t){var i=e.childNodes||[];function s(e){return ji(e)&&e!==t}if(zt(i,s))return!1;var r=zt(i,Fi);return!(t&&r&&i.indexOf(r)>i.indexOf(t))}function Hi(e,t,i){if(!Ui(e))throw new vi(yi,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new vi(_i,"child not in parent");if(!Bi(t)||Fi(t)&&e.nodeType!==Ai.DOCUMENT_NODE)throw new vi(yi,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Wi(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ai.DOCUMENT_FRAGMENT_NODE){var n=r.filter(ji);if(n.length>1||zt(r,qi))throw new vi(yi,"More than one element or text in fragment");if(1===n.length&&!$i(e,i))throw new vi(yi,"Element in fragment can not be inserted before doctype")}if(ji(t)&&!$i(e,i))throw new vi(yi,"Only one element can be added and only after doctype");if(Fi(t)){if(zt(s,Fi))throw new vi(yi,"Only one doctype is allowed");var a=zt(s,ji);if(i&&s.indexOf(a)<s.indexOf(i))throw new vi(yi,"Doctype can only be inserted before an element");if(!i&&a)throw new vi(yi,"Doctype can not be appended since element is present")}}function Gi(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ai.DOCUMENT_FRAGMENT_NODE){var n=r.filter(ji);if(n.length>1||zt(r,qi))throw new vi(yi,"More than one element or text in fragment");if(1===n.length&&!Vi(e,i))throw new vi(yi,"Element in fragment can not be inserted before doctype")}if(ji(t)&&!Vi(e,i))throw new vi(yi,"Only one element can be added and only after doctype");if(Fi(t)){function a(e){return Fi(e)&&e!==i}if(zt(s,a))throw new vi(yi,"Only one doctype is allowed");var o=zt(s,ji);if(i&&s.indexOf(o)<s.indexOf(i))throw new vi(yi,"Doctype can only be inserted before an element")}}function zi(e,t,i,s){Hi(e,t,i),e.nodeType===Ai.DOCUMENT_NODE&&(s||Wi)(e,t,i);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===pi){var n=t.firstChild;if(null==n)return t;var a=t.lastChild}else n=a=t;var o=i?i.previousSibling:e.lastChild;n.previousSibling=o,a.nextSibling=i,o?o.nextSibling=n:e.firstChild=n,null==i?e.lastChild=a:i.previousSibling=a;do{n.parentNode=e}while(n!==a&&(n=n.nextSibling));return Ri(e.ownerDocument||e,e),t.nodeType==pi&&(t.firstChild=t.lastChild=null),t}function Xi(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,Ri(e.ownerDocument,e,t),t}function Ki(){this._nsMap={}}function Yi(){}function Qi(){}function Ji(){}function Zi(){}function es(){}function ts(){}function is(){}function ss(){}function rs(){}function ns(){}function as(){}function os(){}function ls(e,t){var i=[],s=9==this.nodeType&&this.documentElement||this,r=s.prefix,n=s.namespaceURI;if(n&&null==r&&null==(r=s.lookupPrefix(n)))var a=[{namespace:n,prefix:null}];return hs(this,i,e,t,a),i.join("")}function us(e,t,i){var s=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===s&&r===Xt.XML||r===Xt.XMLNS)return!1;for(var n=i.length;n--;){var a=i[n];if(a.prefix===s)return a.namespace!==r}return!0}function ds(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,Di),'"')}function hs(e,t,i,s,r){if(r||(r=[]),s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case si:var n=e.attributes,a=n.length,o=e.firstChild,l=e.tagName,u=l;if(!(i=Xt.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var d,h=0;h<n.length;h++)if("xmlns"===n.item(h).name){d=n.item(h).value;break}if(!d)for(var c=r.length-1;c>=0;c--){if(""===(p=r[c]).prefix&&p.namespace===e.namespaceURI){d=p.namespace;break}}if(d!==e.namespaceURI)for(c=r.length-1;c>=0;c--){var p;if((p=r[c]).namespace===e.namespaceURI){p.prefix&&(u=p.prefix+":"+l);break}}}t.push("<",u);for(var m=0;m<a;m++){"xmlns"==(g=n.item(m)).prefix?r.push({prefix:g.localName,namespace:g.value}):"xmlns"==g.nodeName&&r.push({prefix:"",namespace:g.value})}for(m=0;m<a;m++){var g,f,y;if(us(g=n.item(m),i,r))ds(t,(f=g.prefix||"")?"xmlns:"+f:"xmlns",y=g.namespaceURI),r.push({prefix:f,namespace:y});hs(g,t,i,s,r)}if(l===u&&us(e,i,r))ds(t,(f=e.prefix||"")?"xmlns:"+f:"xmlns",y=e.namespaceURI),r.push({prefix:f,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):hs(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)hs(o,t,i,s,r.slice()),o=o.nextSibling;t.push("</",u,">")}else t.push("/>");return;case hi:case pi:for(o=e.firstChild;o;)hs(o,t,i,s,r.slice()),o=o.nextSibling;return;case ri:return ds(t,e.name,e.value);case ni:return t.push(e.data.replace(/[<&>]/g,Di));case ai:return t.push("<![CDATA[",e.data,"]]>");case di:return t.push("\x3c!--",e.data,"--\x3e");case ci:var _=e.publicId,b=e.systemId;if(t.push("<!DOCTYPE ",e.name),_)t.push(" PUBLIC ",_),b&&"."!=b&&t.push(" ",b),t.push(">");else if(b&&"."!=b)t.push(" SYSTEM ",b,">");else{var v=e.internalSubset;v&&t.push(" [",v,"]"),t.push(">")}return;case ui:return t.push("<?",e.target," ",e.data,"?>");case oi:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function cs(e,t,i){var s;switch(t.nodeType){case si:(s=t.cloneNode(!1)).ownerDocument=e;case pi:break;case ri:i=!0}if(s||(s=t.cloneNode(!1)),s.ownerDocument=e,s.parentNode=null,i)for(var r=t.firstChild;r;)s.appendChild(cs(e,r,i)),r=r.nextSibling;return s}function ps(e,t,i){var s=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];"object"!=typeof n&&n!=s[r]&&(s[r]=n)}switch(t.childNodes&&(s.childNodes=new Ti),s.ownerDocument=e,s.nodeType){case si:var a=t.attributes,o=s.attributes=new wi,l=a.length;o._ownerElement=s;for(var u=0;u<l;u++)s.setAttributeNode(ps(e,a.item(u),!0));break;case ri:i=!0}if(i)for(var d=t.firstChild;d;)s.appendChild(ps(e,d,i)),d=d.nextSibling;return s}function ms(e,t,i){e[t]=i}gi.INVALID_STATE_ERR=(fi[11]="Invalid state",11),gi.SYNTAX_ERR=(fi[12]="Syntax error",12),gi.INVALID_MODIFICATION_ERR=(fi[13]="Invalid modification",13),gi.NAMESPACE_ERR=(fi[14]="Invalid namespace",14),gi.INVALID_ACCESS_ERR=(fi[15]="Invalid access",15),vi.prototype=Error.prototype,ei(gi,vi),Ti.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var i=[],s=0;s<this.length;s++)hs(this[s],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},Si.prototype.item=function(e){return Ei(this),this[e]||null},ti(Si,Ti),wi.prototype={length:0,item:Ti.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new vi(bi);var i=this.getNamedItem(e.nodeName);return Ci(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new vi(bi);return t=this.getNamedItemNS(e.namespaceURI,e.localName),Ci(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return xi(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return xi(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var s=this[i];if(s.localName==t&&s.namespaceURI==e)return s}return null}},Ii.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var s=new Pi;if(s.implementation=this,s.childNodes=new Ti,s.doctype=i||null,i&&s.appendChild(i),t){var r=s.createElementNS(e,t);s.appendChild(r)}return s},createDocumentType:function(e,t,i){var s=new ts;return s.name=e,s.nodeName=e,s.publicId=t||"",s.systemId=i||"",s}},Ai.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return zi(this,e,t)},replaceChild:function(e,t){zi(this,e,t,Gi),t&&this.removeChild(t)},removeChild:function(e){return Mi(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ps(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==ni&&e.nodeType==ni?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s;t=t.nodeType==ri?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==ri?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},ei(ii,Ai),ei(ii,Ai.prototype),Pi.prototype={nodeName:"#document",nodeType:hi,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==pi){for(var i=e.firstChild;i;){var s=i.nextSibling;this.insertBefore(i,t),i=s}return e}return zi(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===si&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Mi(this,e)},replaceChild:function(e,t){zi(this,e,t,Gi),e.ownerDocument=this,t&&this.removeChild(t),ji(e)&&(this.documentElement=e)},importNode:function(e,t){return cs(this,e,t)},getElementById:function(e){var t=null;return Li(this.documentElement,(function(i){if(i.nodeType==si&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=Jt(e);return new Si(this,(function(i){var s=[];return t.length>0&&Li(i.documentElement,(function(r){if(r!==i&&r.nodeType===si){var n=r.getAttribute("class");if(n){var a=e===n;if(!a){var o=Jt(n);a=t.every(Zt(o))}a&&s.push(r)}}})),s}))},createElement:function(e){var t=new Ki;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Ti,(t.attributes=new wi)._ownerElement=t,t},createDocumentFragment:function(){var e=new ns;return e.ownerDocument=this,e.childNodes=new Ti,e},createTextNode:function(e){var t=new Ji;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Zi;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new es;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new as;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Yi;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new rs;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Ki,s=t.split(":"),r=i.attributes=new wi;return i.childNodes=new Ti,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new Yi,s=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,i}},ti(Pi,Ai),Ki.prototype={nodeType:si,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===pi?this.insertBefore(e,null):Xi(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var s=this.ownerDocument.createAttributeNS(e,t);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Si(this,(function(t){var i=[];return Li(t,(function(s){s===t||s.nodeType!=si||"*"!==e&&s.tagName!=e||i.push(s)})),i}))},getElementsByTagNameNS:function(e,t){return new Si(this,(function(i){var s=[];return Li(i,(function(r){r===i||r.nodeType!==si||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||s.push(r)})),s}))}},Pi.prototype.getElementsByTagName=Ki.prototype.getElementsByTagName,Pi.prototype.getElementsByTagNameNS=Ki.prototype.getElementsByTagNameNS,ti(Ki,Ai),Yi.prototype.nodeType=ri,ti(Yi,Ai),Qi.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(fi[yi])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},ti(Qi,Ai),Ji.prototype={nodeName:"#text",nodeType:ni,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var s=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},ti(Ji,Qi),Zi.prototype={nodeName:"#comment",nodeType:di},ti(Zi,Qi),es.prototype={nodeName:"#cdata-section",nodeType:ai},ti(es,Qi),ts.prototype.nodeType=ci,ti(ts,Ai),is.prototype.nodeType=mi,ti(is,Ai),ss.prototype.nodeType=li,ti(ss,Ai),rs.prototype.nodeType=oi,ti(rs,Ai),ns.prototype.nodeName="#document-fragment",ns.prototype.nodeType=pi,ti(ns,Ai),as.prototype.nodeType=ui,ti(as,Ai),os.prototype.serializeToString=function(e,t,i){return ls.call(e,t,i)},Ai.prototype.toString=ls;try{if(Object.defineProperty){function gs(e){switch(e.nodeType){case si:case pi:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(gs(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(Si.prototype,"length",{get:function(){return Ei(this),this.$$length}}),Object.defineProperty(Ai.prototype,"textContent",{get:function(){return gs(this)},set:function(e){switch(this.nodeType){case si:case pi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ms=function(e,t,i){e["$$"+t]=i}}}catch(Gf){}Ft.DocumentType=ts,Ft.DOMException=vi,Ft.DOMImplementation=Ii,Ft.Element=Ki,Ft.Node=Ai,Ft.NodeList=Ti,Ft.XMLSerializer=os;var fs={},ys={};!function(e){var t=jt.freeze;e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES}(ys);var _s={},bs=jt.NAMESPACE,vs=/[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]/,Ts=new RegExp("[\\-\\.0-9"+vs.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ss=new RegExp("^"+vs.source+Ts.source+"*(?::"+vs.source+Ts.source+"*)?$"),Es=0,ws=1,ks=2,Cs=3,xs=4,Is=5,As=6,Ds=7;function Ls(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ls)}function Ps(){}function Os(e,t,i,s,r){function n(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?n(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function o(t){if(t>g){var i=e.substring(g,t).replace(/&#?\w+;/g,a);c&&l(g),s.characters(i,0,t-g),g=t}}function l(t,i){for(;t>=d&&(i=h.exec(e));)u=i.index,d=u+i[0].length,c.lineNumber++;c.columnNumber=t-u+1}for(var u=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,c=s.locator,p=[{currentNSMap:t}],m={},g=0;;){try{var f=e.indexOf("<",g);if(f<0){if(!e.substr(g).match(/^\s*$/)){var y=s.doc,_=y.createTextNode(e.substr(g));y.appendChild(_),s.currentElement=_}return}switch(f>g&&o(f),e.charAt(f+1)){case"/":var b=e.indexOf(">",f+3),v=e.substring(f+2,b).replace(/[ \t\n\r]+$/g,""),T=p.pop();b<0?(v=e.substring(f+2).replace(/[\s<].*/,""),r.error("end tag name: "+v+" is not complete:"+T.tagName),b=f+1+v.length):v.match(/\s</)&&(v=v.replace(/[\s<].*/,""),r.error("end tag name: "+v+" maybe not complete"),b=f+1+v.length);var S=T.localNSMap,E=T.tagName==v;if(E||T.tagName&&T.tagName.toLowerCase()==v.toLowerCase()){if(s.endElement(T.uri,T.localName,v),S)for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&s.endPrefixMapping(w);E||r.fatalError("end tag name: "+v+" is not match the current start tagName:"+T.tagName)}else p.push(T);b++;break;case"?":c&&l(f),b=qs(e,f,s);break;case"!":c&&l(f),b=js(e,f,s,r);break;default:c&&l(f);var k=new $s,C=p[p.length-1].currentNSMap,x=(b=Rs(e,f,k,C,a,r),k.length);if(!k.closed&&Bs(e,b,k.tagName,m)&&(k.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),c&&x){for(var I=Ns(c,{}),A=0;A<x;A++){var D=k[A];l(D.offset),D.locator=Ns(c,{})}s.locator=I,Ms(k,s,C)&&p.push(k),s.locator=c}else Ms(k,s,C)&&p.push(k);bs.isHTML(k.uri)&&!k.closed?b=Us(e,b,k.tagName,a,s):b++}}catch(Gf){if(Gf instanceof Ls)throw Gf;r.error("element parse error: "+Gf),b=-1}b>g?g=b:o(Math.max(f,g)+1)}}function Ns(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Rs(e,t,i,s,r,n){function a(e,t,s){i.attributeNames.hasOwnProperty(e)&&n.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),s)}for(var o,l=++t,u=Es;;){var d=e.charAt(l);switch(d){case"=":if(u===ws)o=e.slice(t,l),u=Cs;else{if(u!==ks)throw new Error("attribute equal must after attrName");u=Cs}break;case"'":case'"':if(u===Cs||u===ws){if(u===ws&&(n.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");a(o,h=e.slice(t,l),t-1),u=Is}else{if(u!=xs)throw new Error('attribute value must after "="');a(o,h=e.slice(t,l),t),n.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,u=Is}break;case"/":switch(u){case Es:i.setTagName(e.slice(t,l));case Is:case As:case Ds:u=Ds,i.closed=!0;case xs:case ws:break;case ks:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),u==Es&&i.setTagName(e.slice(t,l)),l;case">":switch(u){case Es:i.setTagName(e.slice(t,l));case Is:case As:case Ds:break;case xs:case ws:"/"===(h=e.slice(t,l)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case ks:u===ks&&(h=o),u==xs?(n.warning('attribute "'+h+'" missed quot(")!'),a(o,h,t)):(bs.isHTML(s[""])&&h.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),a(h,h,t));break;case Cs:throw new Error("attribute value missed!!")}return l;case"":d=" ";default:if(d<=" ")switch(u){case Es:i.setTagName(e.slice(t,l)),u=As;break;case ws:o=e.slice(t,l),u=ks;break;case xs:var h=e.slice(t,l);n.warning('attribute "'+h+'" missed quot(")!!'),a(o,h,t);case Is:u=As}else switch(u){case ks:i.tagName,bs.isHTML(s[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,u=ws;break;case Is:n.warning('attribute space is required"'+o+'"!!');case As:u=ws,t=l;break;case Cs:u=xs,t=l;break;case Ds:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Ms(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value;if((c=o.indexOf(":"))>0)var u=a.prefix=o.slice(0,c),d=o.slice(c+1),h="xmlns"===u&&d;else d=o,u=null,h="xmlns"===o&&"";a.localName=d,!1!==h&&(null==r&&(r={},Fs(i,i={})),i[h]=r[h]=l,a.uri=bs.XMLNS,t.startPrefixMapping(h,l))}for(n=e.length;n--;){(u=(a=e[n]).prefix)&&("xml"===u&&(a.uri=bs.XML),"xmlns"!==u&&(a.uri=i[u||""]))}var c;(c=s.indexOf(":"))>0?(u=e.prefix=s.slice(0,c),d=e.localName=s.slice(c+1)):(u=null,d=e.localName=s);var p=e.uri=i[u||""];if(t.startElement(p,d,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,d,s),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&t.endPrefixMapping(u)}function Us(e,t,i,s,r){if(/^(?:script|textarea)$/i.test(i)){var n=e.indexOf("</"+i+">",t),a=e.substring(t+1,n);if(/[&<]/.test(a))return/^script$/i.test(i)?(r.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,s),r.characters(a,0,a.length),n)}return t+1}function Bs(e,t,i,s){var r=s[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),s[i]=r),r<t}function Fs(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function js(e,t,i,s){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(s.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var n=Vs(e,t),a=n.length;if(a>1&&/!doctype/i.test(n[0][0])){var o=n[1][0],l=!1,u=!1;a>3&&(/^public$/i.test(n[2][0])?(l=n[3][0],u=a>4&&n[4][0]):/^system$/i.test(n[2][0])&&(u=n[3][0]));var d=n[a-1];return i.startDTD(o,l,u),i.endDTD(),d.index+d[0].length}return-1}function qs(e,t,i){var s=e.indexOf("?>",t);if(s){var r=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),s+2):-1}return-1}function $s(){this.attributeNames={}}function Vs(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(s.push(i),i[1])return s}Ls.prototype=new Error,Ls.prototype.name=Ls.name,Ps.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Fs(t,t={}),Os(e,t,i,s,this.errorHandler),s.endDocument()}},$s.prototype={setTagName:function(e){if(!Ss.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ss.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},_s.XMLReader=Ps,_s.ParseError=Ls;var Hs=jt,Ws=ys,Gs=_s,zs=Ft.DOMImplementation,Xs=Hs.NAMESPACE,Ks=Gs.ParseError,Ys=Gs.XMLReader;function Qs(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Js(e){this.options=e||{locator:{}}}function Zs(e,t,i){if(!e){if(t instanceof er)return t;e=t}var s={},r=e instanceof Function;function n(t){var n=e[t];!n&&r&&(n=2==e.length?function(i){e(t,i)}:e),s[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+ir(i))}||function(){}}return i=i||{},n("warning"),n("error"),n("fatalError"),s}function er(){this.cdata=!1}function tr(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function ir(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function sr(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function rr(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Js.prototype.parseFromString=function(e,t){var i=this.options,s=new Ys,r=i.domBuilder||new er,n=i.errorHandler,a=i.locator,o=i.xmlns||{},l=/\/x?html?$/.test(t),u=l?Ws.HTML_ENTITIES:Ws.XML_ENTITIES;a&&r.setDocumentLocator(a),s.errorHandler=Zs(n,r,a),s.domBuilder=i.domBuilder||r,l&&(o[""]=Xs.HTML),o.xml=o.xml||Xs.XML;var d=i.normalizeLineEndings||Qs;return e&&"string"==typeof e?s.parse(d(e),o,u):s.errorHandler.error("invalid doc source"),r.doc},er.prototype={startDocument:function(){this.doc=(new zs).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;rr(this,n),this.currentElement=n,this.locator&&tr(this.locator,n);for(var o=0;o<a;o++){e=s.getURI(o);var l=s.getValue(o),u=(i=s.getQName(o),r.createAttributeNS(e,i));this.locator&&tr(s.getLocator(o),u),u.value=u.nodeValue=l,n.setAttributeNode(u)}},endElement:function(e,t,i){var s=this.currentElement;s.tagName,this.currentElement=s.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&tr(this.locator,i),rr(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=sr.apply(this,arguments)){if(this.cdata)var s=this.doc.createCDATASection(e);else s=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(e)&&this.doc.appendChild(s),this.locator&&tr(this.locator,s)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=sr.apply(this,arguments);var s=this.doc.createComment(e);this.locator&&tr(this.locator,s),rr(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var s=this.doc.implementation;if(s&&s.createDocumentType){var r=s.createDocumentType(e,t,i);this.locator&&tr(this.locator,r),rr(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,ir(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,ir(this.locator))},fatalError:function(e){throw new Ks(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){er.prototype[e]=function(){return null}})),fs.__DOMHandler=er,fs.normalizeLineEndings=Qs,fs.DOMParser=Js;var nr=fs.DOMParser;const ar=e=>!!e&&"object"==typeof e,or=(...e)=>e.reduce(((e,t)=>("object"!=typeof t||Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ar(e[i])&&ar(t[i])?e[i]=or(e[i],t[i]):e[i]=t[i]})),e)),{}),lr=e=>Object.keys(e).map((t=>e[t])),ur=(e,t)=>{const i=[];for(let s=e;s<t;s++)i.push(s);return i},dr=e=>e.reduce(((e,t)=>e.concat(t)),[]),hr=e=>{if(!e.length)return[];const t=[];for(let i=0;i<e.length;i++)t.push(e[i]);return t},cr=(e,t)=>e.reduce(((e,i,s)=>(i[t]&&e.push(s),e)),[]),pr=(e,t)=>lr(e.reduce(((e,i)=>(i.forEach((i=>{e[t(i)]=i})),e)),{}));var mr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const gr=({baseUrl:e="",source:t="",range:i="",indexRange:s=""})=>{const r={uri:t,resolvedUri:Rt(e||"",t)};if(i||s){const e=(i||s).split("-");let t,n=g.BigInt?g.BigInt(e[0]):parseInt(e[0],10),a=g.BigInt?g.BigInt(e[1]):parseInt(e[1],10);n<Number.MAX_SAFE_INTEGER&&"bigint"==typeof n&&(n=Number(n)),a<Number.MAX_SAFE_INTEGER&&"bigint"==typeof a&&(a=Number(a)),t="bigint"==typeof a||"bigint"==typeof n?g.BigInt(a)-g.BigInt(n)+g.BigInt(1):a-n+1,"bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),r.byterange={length:t,offset:n}}return r},fr=e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?g.BigInt(e.offset)+g.BigInt(e.length)-g.BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`},yr=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),_r={static(e){const{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,n=yr(e.endNumber),a=t/i;return"number"==typeof n?{start:0,end:n}:"number"==typeof r?{start:0,end:r/a}:{start:0,end:s/a}},dynamic(e){const{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,u=yr(e.endNumber),d=(t+i)/1e3,h=s+a,c=d+o-h,p=Math.ceil(c*r/n),m=Math.floor((d-h-l)*r/n),g=Math.floor((d-h)*r/n);return{start:Math.max(0,m),end:"number"==typeof u?u:Math.min(p,g)}}},br=e=>t=>{const{duration:i,timescale:s=1,periodStart:r,startNumber:n=1}=e;return{number:n+t,duration:i/s,timeline:r,time:t*i}},vr=e=>{const{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=_r[t](e),l=ur(a,o).map(br(e));if("static"===t){const e=l.length-1,t="number"==typeof r?r:n;l[e].duration=t-i/s*e}return l},Tr=e=>{const{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(!t)throw new Error(mr.NO_BASE_URL);const u=gr({baseUrl:t,source:i.sourceURL,range:i.range}),d=gr({baseUrl:t,source:t,indexRange:r});if(d.map=u,l){const t=vr(e);t.length&&(d.duration=t[0].duration,d.timeline=t[0].timeline)}else s&&(d.duration=s,d.timeline=n);return d.presentationTime=a||n,d.number=o,[d]},Sr=(e,t,i)=>{const s=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,n=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,l=t.timescale,u=t.references.filter((e=>1!==e.referenceType)),d=[],h=e.endList?"static":"dynamic",c=e.sidx.timeline;let p,m=c,f=e.mediaSequence||0;p="bigint"==typeof t.firstOffset?g.BigInt(o)+t.firstOffset:o+t.firstOffset;for(let y=0;y<u.length;y++){const e=t.references[y],a=e.referencedSize,o=e.subsegmentDuration;let u;u="bigint"==typeof p?p+g.BigInt(a)-g.BigInt(1):p+a-1;const _=Tr({baseUrl:i,timescale:l,timeline:n,periodStart:c,presentationTime:m,number:f,duration:o,sourceDuration:r,indexRange:`${p}-${u}`,type:h})[0];s&&(_.map=s),d.push(_),p+="bigint"==typeof p?g.BigInt(a):a,m+=o/l,f++}return e.segments=d,e},Er=["AUDIO","SUBTITLES"],wr=1/60,kr=e=>pr(e,(({timeline:e})=>e)).sort(((e,t)=>e.timeline>t.timeline?1:-1)),Cr=(e,t)=>{for(let i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null},xr=e=>{let t=[];return Mt(e,Er,((e,i,s,r)=>{t=t.concat(e.playlists||[])})),t},Ir=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},Ar=({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));const s=Cr(e,t.attributes.NAME);if(!s)return;if(t.sidx)return;const r=t.segments[0],n=s.segments.findIndex((function(e){return Math.abs(e.presentationTime-r.presentationTime)<wr}));if(-1===n)return Ir({playlist:t,mediaSequence:s.mediaSequence+s.segments.length}),t.segments[0].discontinuity=!0,t.discontinuityStarts.unshift(0),void((!s.segments.length&&t.timeline>s.timeline||s.segments.length&&t.timeline>s.segments[s.segments.length-1].timeline)&&t.discontinuitySequence--);s.segments[n].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),Ir({playlist:t,mediaSequence:s.segments[n].number})}))},Dr=({oldManifest:e,newManifest:t})=>{const i=e.playlists.concat(xr(e)),s=t.playlists.concat(xr(t));return t.timelineStarts=kr([e.timelineStarts,t.timelineStarts]),Ar({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t},Lr=e=>e&&e.uri+"-"+fr(e.byterange),Pr=e=>lr(e.reduce(((e,t)=>{const i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((e=>(e.discontinuityStarts=cr(e.segments||[],"discontinuity"),e))),Or=(e,t)=>{const i=Lr(e.sidx),s=i&&t[i]&&t[i].sidx;return s&&Sr(e,s,e.sidx.resolvedUri),e},Nr=(e,t={})=>{if(!Object.keys(t).length)return e;for(const i in e)e[i]=Or(e[i],t);return e},Rr=({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{const o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},Mr=({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);const n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};return e.codecs&&(n.CODECS=e.codecs),{attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t}},Ur=(e,t={},i=!1)=>{let s;const r=e.reduce(((e,r)=>{const n=r.attributes.role&&r.attributes.role.value||"",a=r.attributes.lang||"";let o=r.attributes.label||"main";if(a&&!r.attributes.label){const e=n?` (${n})`:"";o=`${r.attributes.lang}${e}`}e[o]||(e[o]={language:a,autoselect:!0,default:"main"===n,playlists:[],uri:""});const l=Or(Rr(r,i),t);return e[o].playlists.push(l),void 0===s&&"main"===n&&(s=r,s.default=!0),e}),{});if(!s){r[Object.keys(r)[0]].default=!0}return r},Br=(e,t={})=>e.reduce(((e,i)=>{const s=i.attributes.label||i.attributes.lang||"text";return e[s]||(e[s]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),e[s].playlists.push(Or(Mr(i),t)),e}),{}),Fr=e=>e.reduce(((e,t)=>t?(t.forEach((t=>{const{channel:i,language:s}=t;e[s]={autoselect:!1,default:!1,instreamId:i,language:s},t.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[s].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[s]["3D"]=t["3D"])})),e):e),{}),jr=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{const r={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(r.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(r.contentProtection=e.contentProtection),i&&(r.sidx=i),r},qr=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,$r=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Vr=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,Hr=(e,t)=>{e.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=t.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))}))},Wr=e=>e?Object.keys(e).reduce(((t,i)=>{const s=e[i];return t.concat(s.playlists)}),[]):[],Gr=({dashPlaylists:e,locations:t,sidxMapping:i={},previousManifest:s,eventStream:r})=>{if(!e.length)return{};const{sourceDuration:n,type:a,suggestedPresentationDelay:o,minimumUpdatePeriod:l}=e[0].attributes,u=Pr(e.filter(qr)).map(jr),d=Pr(e.filter($r)),h=Pr(e.filter(Vr)),c=e.map((e=>e.attributes.captionServices)).filter(Boolean),p={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:n,playlists:Nr(u,i)};l>=0&&(p.minimumUpdatePeriod=1e3*l),t&&(p.locations=t),"dynamic"===a&&(p.suggestedPresentationDelay=o),r&&r.length>0&&(p.eventStream=r);const m=0===p.playlists.length,g=d.length?Ur(d,i,m):null,f=h.length?Br(h,i):null,y=u.concat(Wr(g),Wr(f)),_=y.map((({timelineStarts:e})=>e));return p.timelineStarts=kr(_),Hr(y,p.timelineStarts),g&&(p.mediaGroups.AUDIO.audio=g),f&&(p.mediaGroups.SUBTITLES.subs=f),c.length&&(p.mediaGroups["CLOSED-CAPTIONS"].cc=Fr(c)),s?Dr({oldManifest:s,newManifest:p}):p},zr=(e,t,i)=>{const{NOW:s,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=e,u=(s+r)/1e3+l-(n+o);return Math.ceil((u*a-t)/i)},Xr=(e,t)=>{const{type:i,minimumUpdatePeriod:s=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=e,u=[];let d=-1;for(let h=0;h<t.length;h++){const c=t[h],p=c.d,m=c.r||0,g=c.t||0;let f;if(d<0&&(d=g),g&&g>d&&(d=g),m<0){const o=h+1;f=o===t.length?"dynamic"===i&&s>0&&r.indexOf("$Number$")>0?zr(e,d,p):(n*a-d)/p:(t[o].t-d)/p}else f=m+1;const y=o+u.length+f;let _=o+u.length;for(;_<y;)u.push({number:_,duration:p/a,time:d,timeline:l}),d+=p,_++}return u},Kr=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Yr=e=>(t,i,s,r)=>{if("$$"===t)return"$";if(void 0===e[i])return t;const n=""+e[i];return"RepresentationID"===i?n:(r=s?parseInt(r,10):1,n.length>=r?n:`${new Array(r-n.length+1).join("0")}${n}`)},Qr=(e,t)=>e.replace(Kr,Yr(t)),Jr=(e,t)=>e.duration||t?e.duration?vr(e):Xr(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}],Zr=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,r=gr({baseUrl:e.baseUrl,source:Qr(s.sourceURL,i),range:s.range});return Jr(e,t).map((t=>{i.Number=t.number,i.Time=t.time;const s=Qr(e.media||"",i),n=e.timescale||1,a=e.presentationTimeOffset||0,o=e.periodStart+(t.time-a)/n;return{uri:s,timeline:t.timeline,duration:t.duration,resolvedUri:Rt(e.baseUrl||"",s),map:r,number:t.number,presentationTime:o}}))},en=(e,t)=>{const{baseUrl:i,initialization:s={}}=e,r=gr({baseUrl:i,source:s.sourceURL,range:s.range}),n=gr({baseUrl:i,source:t.media,range:t.mediaRange});return n.map=r,n},tn=(e,t)=>{const{duration:i,segmentUrls:s=[],periodStart:r}=e;if(!i&&!t||i&&t)throw new Error(mr.SEGMENT_TIME_UNSPECIFIED);const n=s.map((t=>en(e,t)));let a;i&&(a=vr(e)),t&&(a=Xr(e,t));return a.map(((t,i)=>{if(n[i]){const s=n[i],a=e.timescale||1,o=e.presentationTimeOffset||0;return s.timeline=t.timeline,s.duration=t.duration,s.number=t.number,s.presentationTime=r+(t.time-o)/a,s}})).filter((e=>e))},sn=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Zr,i=or(e,t.template)):t.base?(s=Tr,i=or(e,t.base)):t.list&&(s=tn,i=or(e,t.list));const r={attributes:e};if(!s)return r;const n=s(i,t.segmentTimeline);if(i.duration){const{duration:e,timescale:t=1}=i;i.duration=e/t}else n.length?i.duration=n.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0;return r.attributes=i,r.segments=n,t.base&&i.indexRange&&(r.sidx=n[0],r.segments=[]),r},rn=e=>e.map(sn),nn=(e,t)=>hr(e.childNodes).filter((({tagName:e})=>e===t)),an=e=>e.textContent.trim(),on=e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))),ln=e=>{const t=31536e3,i=2592e3,s=86400,r=3600,n=60,a=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!a)return 0;const[o,l,u,d,h,c]=a.slice(1);return parseFloat(o||0)*t+parseFloat(l||0)*i+parseFloat(u||0)*s+parseFloat(d||0)*r+parseFloat(h||0)*n+parseFloat(c||0)},un=e=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)),dn={mediaPresentationDuration:e=>ln(e),availabilityStartTime:e=>un(e)/1e3,minimumUpdatePeriod:e=>ln(e),suggestedPresentationDelay:e=>ln(e),type:e=>e,timeShiftBufferDepth:e=>ln(e),start:e=>ln(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>on(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){const t=parseInt(e,10);return isNaN(t)?ln(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},hn=e=>e&&e.attributes?hr(e.attributes).reduce(((e,t)=>{const i=dn[t.name]||dn.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},cn={"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"},pn=(e,t)=>t.length?dr(e.map((function(e){return t.map((function(t){return Rt(e,an(t))}))}))):e,mn=e=>{const t=nn(e,"SegmentTemplate")[0],i=nn(e,"SegmentList")[0],s=i&&nn(i,"SegmentURL").map((e=>or({tag:"SegmentURL"},hn(e)))),r=nn(e,"SegmentBase")[0],n=i||t,a=n&&nn(n,"SegmentTimeline")[0],o=i||r||t,l=o&&nn(o,"Initialization")[0],u=t&&hn(t);u&&l?u.initialization=l&&hn(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});const d={template:u,segmentTimeline:a&&nn(a,"S").map((e=>hn(e))),list:i&&or(hn(i),{segmentUrls:s,initialization:hn(l)}),base:r&&or(hn(r),{initialization:hn(l)})};return Object.keys(d).forEach((e=>{d[e]||delete d[e]})),d},gn=(e,t,i)=>s=>{const r=nn(s,"BaseURL"),n=pn(t,r),a=or(e,hn(s)),o=mn(s);return n.map((e=>({segmentInfo:or(i,o),attributes:or(a,{baseUrl:e})})))},fn=e=>e.reduce(((e,t)=>{const i=hn(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const s=cn[i.schemeIdUri];if(s){e[s]={attributes:i};const r=nn(t,"cenc:pssh")[0];if(r){const t=an(r);e[s].pssh=t&&Bt(t)}}return e}),{}),yn=e=>{if("urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri){return("string"!=typeof e.value?[]:e.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}))}if("urn:scte:dash:cc:cea-708:2015"===e.schemeIdUri){return("string"!=typeof e.value?[]:e.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[i,s=""]=e.split("=");t.channel=i,t.language=e,s.split(",").forEach((e=>{const[i,s]=e.split(":");"lang"===i?t.language=s:"er"===i?t.easyReader=Number(s):"war"===i?t.aspectRatio=Number(s):"3D"===i&&(t["3D"]=Number(s))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}))}},_n=e=>dr(nn(e.node,"EventStream").map((t=>{const i=hn(t),s=i.schemeIdUri;return nn(t,"Event").map((t=>{const r=hn(t),n=r.presentationTime||0,a=i.timescale||1,o=r.duration||0,l=n/a+e.attributes.start;return{schemeIdUri:s,value:i.value,id:r.id,start:l,end:l+o/a,messageData:an(t)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),bn=(e,t,i)=>s=>{const r=hn(s),n=pn(t,nn(s,"BaseURL")),a=nn(s,"Role")[0],o={role:hn(a)};let l=or(e,r,o);const u=nn(s,"Accessibility")[0],d=yn(hn(u));d&&(l=or(l,{captionServices:d}));const h=nn(s,"Label")[0];if(h&&h.childNodes.length){const e=h.childNodes[0].nodeValue.trim();l=or(l,{label:e})}const c=fn(nn(s,"ContentProtection"));Object.keys(c).length&&(l=or(l,{contentProtection:c}));const p=mn(s),m=nn(s,"Representation"),g=or(i,p);return dr(m.map(gn(l,n,g)))},vn=(e,t)=>(i,s)=>{const r=pn(t,nn(i.node,"BaseURL")),n=or(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(n.periodDuration=i.attributes.duration);const a=nn(i.node,"AdaptationSet"),o=mn(i.node);return dr(a.map(bn(n,r,o)))},Tn=({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0,Sn=(e,t={})=>{const{manifestUri:i="",NOW:s=Date.now(),clientOffset:r=0}=t,n=nn(e,"Period");if(!n.length)throw new Error(mr.INVALID_NUMBER_OF_PERIOD);const a=nn(e,"Location"),o=hn(e),l=pn([i],nn(e,"BaseURL"));o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=s,o.clientOffset=r,a.length&&(o.locations=a.map(an));const u=[];return n.forEach(((e,t)=>{const i=hn(e),s=u[t-1];i.start=Tn({attributes:i,priorPeriodAttributes:s?s.attributes:null,mpdType:o.type}),u.push({node:e,attributes:i})})),{locations:o.locations,representationInfo:dr(u.map(vn(o,l))),eventStream:dr(u.map(_n))}},En=e=>{if(""===e)throw new Error(mr.DASH_EMPTY_MANIFEST);const t=new nr;let i,s;try{i=t.parseFromString(e,"application/xml"),s=i&&"MPD"===i.documentElement.tagName?i.documentElement:null}catch(Gf){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error(mr.DASH_INVALID_XML);return s},wn=e=>{const t=nn(e,"UTCTiming")[0];if(!t)return null;const i=hn(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error(mr.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},kn=(e,t={})=>{const i=Sn(En(e),t),s=rn(i.representationInfo);return Gr({dashPlaylists:s,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})},Cn=e=>wn(En(e));var xn=Math.pow(2,32),In={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*xn+i.getUint32(4)},MAX_UINT32:xn}.getUint64;const An=h((function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},s=12;0===i.version?(i.earliestPresentationTime=t.getUint32(s),i.firstOffset=t.getUint32(s+4),s+=8):(i.earliestPresentationTime=In(e.subarray(s)),i.firstOffset=In(e.subarray(s+8)),s+=16),s+=2;var r=t.getUint16(s);for(s+=2;r>0;s+=12,r--)i.references.push({referenceType:(128&e[s])>>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i}));var Dn=Ct([73,68,51]),Ln=function(e,t){void 0===t&&(t=0);var i=(e=Ct(e))[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?s+20:s+10},Pn=function e(t,i){return void 0===i&&(i=0),(t=Ct(t)).length-i<10||!Ot(t,Dn,{offset:i})?i:e(t,i+=Ln(t,i))},On=function(e){return"string"==typeof e?Lt(e):e},Nn=function(e){return Array.isArray(e)?e.map((function(e){return On(e)})):[On(e)]},Rn=function e(t,i,s){void 0===s&&(s=!1),i=Nn(i),t=Ct(t);var r=[];if(!i.length)return r;for(var n=0;n<t.length;){var a=(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0,o=t.subarray(n+4,n+8);if(0===a)break;var l=n+a;if(l>t.length){if(s)break;l=t.length}var u=t.subarray(n+8,l);Ot(o,i[0])&&(1===i.length?r.push(u):r.push.apply(r,e(u,i.slice(1),s))),n=l}return r},Mn={EBML:Ct([26,69,223,163]),DocType:Ct([66,130]),Segment:Ct([24,83,128,103]),SegmentInfo:Ct([21,73,169,102]),Tracks:Ct([22,84,174,107]),Track:Ct([174]),TrackNumber:Ct([215]),DefaultDuration:Ct([35,227,131]),TrackEntry:Ct([174]),TrackType:Ct([131]),FlagDefault:Ct([136]),CodecID:Ct([134]),CodecPrivate:Ct([99,162]),VideoTrack:Ct([224]),AudioTrack:Ct([225]),Cluster:Ct([31,67,182,117]),Timestamp:Ct([231]),TimestampScale:Ct([42,215,177]),BlockGroup:Ct([160]),BlockDuration:Ct([155]),Block:Ct([161]),SimpleBlock:Ct([163])},Un=[128,64,32,16,8,4,2,1],Bn=function(e){for(var t=1,i=0;i<Un.length&&!(e&Un[i]);i++)t++;return t},Fn=function(e,t,i,s){void 0===i&&(i=!0),void 0===s&&(s=!1);var r=Bn(e[t]),n=e.subarray(t,t+r);return i&&((n=Array.prototype.slice.call(e,t,t+r))[0]^=Un[r-1]),{length:r,value:At(n,{signed:s}),bytes:n}},jn=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map((function(t){return e(t)})):"number"==typeof t?Dt(t):t},qn=function(e){return Array.isArray(e)?e.map((function(e){return jn(e)})):[jn(e)]},$n=function e(t,i,s){if(s>=i.length)return i.length;var r=Fn(i,s,!1);if(Ot(t.bytes,r.bytes))return s;var n=Fn(i,s+r.length);return e(t,i,s+n.length+n.value+r.length)},Vn=function e(t,i){i=qn(i),t=Ct(t);var s=[];if(!i.length)return s;for(var r=0;r<t.length;){var n=Fn(t,r,!1),a=Fn(t,r+n.length),o=r+n.length+a.length;127===a.value&&(a.value=$n(n,t,o),a.value!==t.length&&(a.value-=o));var l=o+a.value>t.length?t.length:o+a.value,u=t.subarray(o,l);Ot(i[0],n.bytes)&&(1===i.length?s.push(u):s=s.concat(e(u,i.slice(1)))),r+=n.length+a.length+u.length}return s},Hn=Ct([0,0,0,1]),Wn=Ct([0,0,1]),Gn=Ct([0,0,3]),zn=function(e){for(var t=[],i=1;i<e.length-2;)Ot(e.subarray(i,i+3),Gn)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var s=e.length-t.length,r=new Uint8Array(s),n=0;for(i=0;i<s;n++,i++)n===t[0]&&(n++,t.shift()),r[i]=e[n];return r},Xn=function(e,t,i,s){void 0===s&&(s=1/0),e=Ct(e),i=[].concat(i);for(var r,n=0,a=0;n<e.length&&(a<s||r);){var o=void 0;if(Ot(e.subarray(n),Hn)?o=4:Ot(e.subarray(n),Wn)&&(o=3),o){if(a++,r)return zn(e.subarray(r,n));var l=void 0;"h264"===t?l=31&e[n+o]:"h265"===t&&(l=e[n+o]>>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)},Kn=function(e,t,i){return Xn(e,"h264",t,i)},Yn=function(e,t,i){return Xn(e,"h265",t,i)},Qn={webm:Ct([119,101,98,109]),matroska:Ct([109,97,116,114,111,115,107,97]),flac:Ct([102,76,97,67]),ogg:Ct([79,103,103,83]),ac3:Ct([11,119]),riff:Ct([82,73,70,70]),avi:Ct([65,86,73]),wav:Ct([87,65,86,69]),"3gp":Ct([102,116,121,112,51,103]),mp4:Ct([102,116,121,112]),fmp4:Ct([115,116,121,112]),mov:Ct([102,116,121,112,113,116]),moov:Ct([109,111,111,118]),moof:Ct([109,111,111,102])},Jn={aac:function(e){var t=Pn(e);return Ot(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Pn(e);return Ot(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Vn(e,[Mn.EBML,Mn.DocType])[0];return Ot(t,Qn.webm)},mkv:function(e){var t=Vn(e,[Mn.EBML,Mn.DocType])[0];return Ot(t,Qn.matroska)},mp4:function(e){return!Jn["3gp"](e)&&!Jn.mov(e)&&(!(!Ot(e,Qn.mp4,{offset:4})&&!Ot(e,Qn.fmp4,{offset:4}))||(!(!Ot(e,Qn.moof,{offset:4})&&!Ot(e,Qn.moov,{offset:4}))||void 0))},mov:function(e){return Ot(e,Qn.mov,{offset:4})},"3gp":function(e){return Ot(e,Qn["3gp"],{offset:4})},ac3:function(e){var t=Pn(e);return Ot(e,Qn.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=Pn(e);return Ot(e,Qn.flac,{offset:t})},ogg:function(e){return Ot(e,Qn.ogg)},avi:function(e){return Ot(e,Qn.riff)&&Ot(e,Qn.avi,{offset:8})},wav:function(e){return Ot(e,Qn.riff)&&Ot(e,Qn.wav,{offset:8})},h264:function(e){return Kn(e,7,3).length},h265:function(e){return Yn(e,[32,33],3).length}},Zn=Object.keys(Jn).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);Zn.forEach((function(e){var t=Jn[e];Jn[e]=function(e){return t(Ct(e))}}));var ea,ta,ia,sa,ra,na,aa,oa=Jn,la=function(e){e=Ct(e);for(var t=0;t<Zn.length;t++){var i=Zn[t];if(oa[i](e))return i}return""},ua=function(e){return Rn(e,["moof"]).length>0},da=9e4;ra=function(e,t){return ea(sa(e,t))},na=function(e,t){return ta(ia(e),t)},aa=function(e,t,i){return ia(i?e:e-t)};var ha={ONE_SECOND_IN_TS:da,secondsToVideoTs:ea=function(e){return e*da},secondsToAudioTs:ta=function(e,t){return e*t},videoTsToSeconds:ia=function(e){return e/da},audioTsToSeconds:sa=function(e,t){return e/t},audioTsToVideoTs:ra,videoTsToAudioTs:na,metadataTsToSeconds:aa},ca="8.3.0";const pa={},ma=function(e,t){return pa[e]=pa[e]||[],t&&(pa[e]=pa[e].concat(t)),pa[e]},ga=function(e,t){ma(e,t)},fa=function(e,t){const i=ma(e).indexOf(t);return!(i<=-1)&&(pa[e]=pa[e].slice(),pa[e].splice(i,1),!0)},ya=function(e,t){ma(e,[].concat(t).map((t=>{const i=(...s)=>(fa(e,i),t(...s));return i})))},_a={prefixed:!0},ba=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],va=ba[0];let Ta;for(let zf=0;zf<ba.length;zf++)if(ba[zf][1]in S){Ta=ba[zf];break}if(Ta){for(let Xf=0;Xf<Ta.length;Xf++)_a[va[Xf]]=Ta[Xf];_a.prefixed=Ta[0]!==va[0]}let Sa=[];const Ea=(e,t)=>(i,s,r)=>{const n=t.levels[s],a=new RegExp(`^(${n})$`);if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),Sa){Sa.push([].concat(r));const e=Sa.length-1e3;Sa.splice(0,e>0?e:0)}if(!g.console)return;let o=g.console[i];o||"debug"!==i||(o=g.console.info||g.console.log),o&&n&&a.test(i)&&o[Array.isArray(r)?"apply":"call"](g.console,r)};function wa(e){let t,i="info";const s=function(...e){t("log",i,e)};return t=Ea(e,s),s.createLogger=t=>wa(e+": "+t),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},s.level=e=>{if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);i=e}return i},s.history=()=>Sa?[].concat(Sa):[],s.history.filter=e=>(Sa||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),s.history.clear=()=>{Sa&&(Sa.length=0)},s.history.disable=()=>{null!==Sa&&(Sa.length=0,Sa=null)},s.history.enable=()=>{null===Sa&&(Sa=[])},s.error=(...e)=>t("error",i,e),s.warn=(...e)=>t("warn",i,e),s.debug=(...e)=>t("debug",i,e),s}const ka=wa("VIDEOJS"),Ca=ka.createLogger,xa=Object.prototype.toString,Ia=function(e){return La(e)?Object.keys(e):[]};function Aa(e,t){Ia(e).forEach((i=>t(e[i],i)))}function Da(e,t,i=0){return Ia(e).reduce(((i,s)=>t(i,e[s],s)),i)}function La(e){return!!e&&"object"==typeof e}function Pa(e){return La(e)&&"[object Object]"===xa.call(e)&&e.constructor===Object}function Oa(...e){const t={};return e.forEach((e=>{e&&Aa(e,((e,i)=>{Pa(e)?(Pa(t[i])||(t[i]={}),t[i]=Oa(t[i],e)):t[i]=e}))})),t}function Na(e,t,i,s=!0){const r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const e=i();return r(e),e}};return s&&(n.set=r),Object.defineProperty(e,t,n)}var Ra=Object.freeze({__proto__:null,each:Aa,reduce:Da,isObject:La,isPlain:Pa,merge:Oa,defineLazyProperty:Na});let Ma,Ua=!1,Ba=null,Fa=!1,ja=!1,qa=!1,$a=!1,Va=!1,Ha=null,Wa=null,Ga=null,za=!1,Xa=!1,Ka=!1,Ya=!1;const Qa=Boolean(ro()&&("ontouchstart"in g||g.navigator.maxTouchPoints||g.DocumentTouch&&g.document instanceof g.DocumentTouch)),Ja=g.navigator&&g.navigator.userAgentData;if(Ja&&(Fa="Android"===Ja.platform,qa=Boolean(Ja.brands.find((e=>"Microsoft Edge"===e.brand))),$a=Boolean(Ja.brands.find((e=>"Chromium"===e.brand))),Va=!qa&&$a,Ha=Wa=(Ja.brands.find((e=>"Chromium"===e.brand))||{}).version||null,Xa="Windows"===Ja.platform),!$a){const Kf=g.navigator&&g.navigator.userAgent||"";Ua=/iPod/i.test(Kf),Ba=function(){const e=Kf.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Fa=/Android/i.test(Kf),Ma=function(){const e=Kf.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),ja=/Firefox/i.test(Kf),qa=/Edg/i.test(Kf),$a=/Chrome/i.test(Kf)||/CriOS/i.test(Kf),Va=!qa&&$a,Ha=Wa=function(){const e=Kf.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ga=function(){const e=/MSIE\s(\d+)\.\d/.exec(Kf);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Kf)&&/rv:11.0/.test(Kf)&&(t=11),t}(),za=/Safari/i.test(Kf)&&!Va&&!Fa&&!qa,Xa=/Windows/i.test(Kf),Ka=/iPad/i.test(Kf)||za&&Qa&&!/iPhone/i.test(Kf),Ya=/iPhone/i.test(Kf)&&!Ka}const Za=Ya||Ka||Ua,eo=(za||Za)&&!Va;var to=Object.freeze({__proto__:null,get IS_IPOD(){return Ua},get IOS_VERSION(){return Ba},get IS_ANDROID(){return Fa},get ANDROID_VERSION(){return Ma},get IS_FIREFOX(){return ja},get IS_EDGE(){return qa},get IS_CHROMIUM(){return $a},get IS_CHROME(){return Va},get CHROMIUM_VERSION(){return Ha},get CHROME_VERSION(){return Wa},get IE_VERSION(){return Ga},get IS_SAFARI(){return za},get IS_WINDOWS(){return Xa},get IS_IPAD(){return Ka},get IS_IPHONE(){return Ya},TOUCH_ENABLED:Qa,IS_IOS:Za,IS_ANY_SAFARI:eo});function io(e){return"string"==typeof e&&Boolean(e.trim())}function so(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ro(){return S===g.document}function no(e){return La(e)&&1===e.nodeType}function ao(){try{return g.parent!==g.self}catch(e){return!0}}function oo(e){return function(t,i){if(!io(t))return S[e](null);io(i)&&(i=S.querySelector(i));const s=no(i)?i:S;return s[e]&&s[e](t)}}function lo(e="div",t={},i={},s){const r=S.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){const i=t[e];"textContent"===e?uo(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),s&&Ao(r,s),r}function uo(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function ho(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function co(e,t){return so(t),e.classList.contains(t)}function po(e,...t){return e.classList.add(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e}function mo(e,...t){return e?(e.classList.remove(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e):(ka.warn("removeClass was called with an element that doesn't exist"),null)}function go(e,t,i){return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=void 0),t.split(/\s+/).forEach((t=>e.classList.toggle(t,i))),e}function fo(e,t){Object.getOwnPropertyNames(t).forEach((function(i){const s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)}))}function yo(e){const t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0){const s=e.attributes;for(let r=s.length-1;r>=0;r--){const n=s[r].name;let a=s[r].value;"boolean"!=typeof e[n]&&-1===i.indexOf(","+n+",")||(a=null!==a),t[n]=a}}return t}function _o(e,t){return e.getAttribute(t)}function bo(e,t,i){e.setAttribute(t,i)}function vo(e,t){e.removeAttribute(t)}function To(){S.body.focus(),S.onselectstart=function(){return!1}}function So(){S.onselectstart=function(){return!0}}function Eo(e){if(e&&e.getBoundingClientRect&&e.parentNode){const t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(No(e,"height"))),i.width||(i.width=parseFloat(No(e,"width"))),i}}function wo(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};const t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==S[_a.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function ko(e,t){const i={x:0,y:0};if(Za){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){const e=No(t,"transform");if(/^matrix/.test(e)){const t=e.slice(7,-1).split(/,\s/).map(Number);i.x+=t[4],i.y+=t[5]}else if(/^matrix3d/.test(e)){const t=e.slice(9,-1).split(/,\s/).map(Number);i.x+=t[12],i.y+=t[13]}t=t.parentNode}}const s={},r=wo(t.target),n=wo(e),a=n.width,o=n.height;let l=t.offsetY-(n.top-r.top),u=t.offsetX-(n.left-r.left);return t.changedTouches&&(u=t.changedTouches[0].pageX-n.left,l=t.changedTouches[0].pageY+n.top,Za&&(u-=i.x,l-=i.y)),s.y=1-Math.max(0,Math.min(1,l/o)),s.x=Math.max(0,Math.min(1,u/a)),s}function Co(e){return La(e)&&3===e.nodeType}function xo(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Io(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((e=>("function"==typeof e&&(e=e()),no(e)||Co(e)?e:"string"==typeof e&&/\S/.test(e)?S.createTextNode(e):void 0))).filter((e=>e))}function Ao(e,t){return Io(t).forEach((t=>e.appendChild(t))),e}function Do(e,t){return Ao(xo(e),t)}function Lo(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}const Po=oo("querySelector"),Oo=oo("querySelectorAll");function No(e,t){if(!e||!t)return"";if("function"==typeof g.getComputedStyle){let i;try{i=g.getComputedStyle(e)}catch(Gf){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}var Ro=Object.freeze({__proto__:null,isReal:ro,isEl:no,isInFrame:ao,createEl:lo,textContent:uo,prependTo:ho,hasClass:co,addClass:po,removeClass:mo,toggleClass:go,setAttributes:fo,getAttributes:yo,getAttribute:_o,setAttribute:bo,removeAttribute:vo,blockTextSelection:To,unblockTextSelection:So,getBoundingClientRect:Eo,findPosition:wo,getPointerPosition:ko,isTextNode:Co,emptyEl:xo,normalizeContent:Io,appendContent:Ao,insertContent:Do,isSingleLeftClick:Lo,$:Po,$$:Oo,computedStyle:No});let Mo,Uo=!1;const Bo=function(){if(!1===Mo.options.autoSetup)return;const e=Array.prototype.slice.call(S.getElementsByTagName("video")),t=Array.prototype.slice.call(S.getElementsByTagName("audio")),i=Array.prototype.slice.call(S.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&s.length>0)for(let r=0,n=s.length;r<n;r++){const e=s[r];if(!e||!e.getAttribute){Fo(1);break}if(void 0===e.player){null!==e.getAttribute("data-setup")&&Mo(e)}}else Uo||Fo(1)};function Fo(e,t){ro()&&(t&&(Mo=t),g.setTimeout(Bo,e))}function jo(){Uo=!0,g.removeEventListener("load",jo)}ro()&&("complete"===S.readyState?jo():g.addEventListener("load",jo));const qo=function(e){const t=S.createElement("style");return t.className=e,t},$o=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t};var Vo=new WeakMap;let Ho,Wo=3;function Go(){return Wo++}function zo(e,t){if(!Vo.has(e))return;const i=Vo.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&Vo.delete(e)}function Xo(e,t,i,s){i.forEach((function(i){e(t,i,s)}))}function Ko(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){const s=e||g.event;e={};for(const t in s)"layerX"!==t&&"layerY"!==t&&"keyLocation"!==t&&"webkitMovementX"!==t&&"webkitMovementY"!==t&&"path"!==t&&("returnValue"===t&&s.preventDefault||(e[t]=s[t]));if(e.target||(e.target=e.srcElement||S),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){s.preventDefault&&s.preventDefault(),e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){const t=S.documentElement,i=S.body;e.pageX=e.clientX+(t&&t.scrollLeft||i&&i.scrollLeft||0)-(t&&t.clientLeft||i&&i.clientLeft||0),e.pageY=e.clientY+(t&&t.scrollTop||i&&i.scrollTop||0)-(t&&t.clientTop||i&&i.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}const Yo=function(){if("boolean"!=typeof Ho){Ho=!1;try{const e=Object.defineProperty({},"passive",{get(){Ho=!0}});g.addEventListener("test",null,e),g.removeEventListener("test",null,e)}catch(Gf){}}return Ho},Qo=["touchstart","touchmove"];function Jo(e,t,i){if(Array.isArray(t))return Xo(Jo,e,t,i);Vo.has(e)||Vo.set(e,{});const s=Vo.get(e);if(s.handlers||(s.handlers={}),s.handlers[t]||(s.handlers[t]=[]),i.guid||(i.guid=Go()),s.handlers[t].push(i),s.dispatcher||(s.disabled=!1,s.dispatcher=function(t,i){if(s.disabled)return;t=Ko(t);const r=s.handlers[t.type];if(r){const s=r.slice(0);for(let r=0,n=s.length;r<n&&!t.isImmediatePropagationStopped();r++)try{s[r].call(e,t,i)}catch(Gf){ka.error(Gf)}}}),1===s.handlers[t].length)if(e.addEventListener){let i=!1;Yo()&&Qo.indexOf(t)>-1&&(i={passive:!0}),e.addEventListener(t,s.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,s.dispatcher)}function Zo(e,t,i){if(!Vo.has(e))return;const s=Vo.get(e);if(!s.handlers)return;if(Array.isArray(t))return Xo(Zo,e,t,i);const r=function(e,t){s.handlers[t]=[],zo(e,t)};if(void 0===t){for(const t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&r(e,t);return}const n=s.handlers[t];if(n)if(i){if(i.guid)for(let e=0;e<n.length;e++)n[e].guid===i.guid&&n.splice(e--,1);zo(e,t)}else r(e,t)}function el(e,t,i){const s=Vo.has(e)?Vo.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Ko(t),s.dispatcher&&s.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)el.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){Vo.has(t.target)||Vo.set(t.target,{});const e=Vo.get(t.target);t.target[t.type]&&(e.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),e.disabled=!1)}return!t.defaultPrevented}function tl(e,t,i){if(Array.isArray(t))return Xo(tl,e,t,i);const s=function(){Zo(e,t,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Go(),Jo(e,t,s)}function il(e,t,i){const s=function(){Zo(e,t,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Go(),Jo(e,t,s)}var sl=Object.freeze({__proto__:null,fixEvent:Ko,on:Jo,off:Zo,trigger:el,one:tl,any:il});const rl=30,nl=function(e,t,i){t.guid||(t.guid=Go());const s=t.bind(e);return s.guid=i?i+"_"+t.guid:t.guid,s},al=function(e,t){let i=g.performance.now();return function(...s){const r=g.performance.now();r-i>=t&&(e(...s),i=r)}},ol=function(e,t,i,s=g){let r;const n=()=>{s.clearTimeout(r),r=null},a=function(){const n=this,a=arguments;let o=function(){r=null,o=null,i||e.apply(n,a)};!r&&i&&e.apply(n,a),s.clearTimeout(r),r=s.setTimeout(o,t)};return a.cancel=n,a};var ll=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:rl,bind_:nl,throttle:al,debounce:ol});let ul;class dl{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Jo(this,e,t),this.addEventListener=i}off(e,t){Zo(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},tl(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},il(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;"string"==typeof e&&(e={type:t}),e=Ko(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),el(this,e)}queueTrigger(e){ul||(ul=new Map);const t=e.type||e;let i=ul.get(this);i||(i=new Map,ul.set(this,i));const s=i.get(t);i.delete(t),g.clearTimeout(s);const r=g.setTimeout((()=>{i.delete(t),0===i.size&&(i=null,ul.delete(this)),this.trigger(e)}),0);i.set(t,r)}}dl.prototype.allowedEvents_={},dl.prototype.addEventListener=dl.prototype.on,dl.prototype.removeEventListener=dl.prototype.off,dl.prototype.dispatchEvent=dl.prototype.trigger;const hl=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e,cl=e=>e instanceof dl||!!e.eventBusEl_&&["on","one","off","trigger"].every((t=>"function"==typeof e[t])),pl=(e,t)=>{cl(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))},ml=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,gl=(e,t,i)=>{if(!e||!e.nodeName&&!cl(e))throw new Error(`Invalid target for ${hl(t)}#${i}; must be a DOM node or evented object.`)},fl=(e,t,i)=>{if(!ml(e))throw new Error(`Invalid event type for ${hl(t)}#${i}; must be a non-empty string or array.`)},yl=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${hl(t)}#${i}; must be a function.`)},_l=(e,t,i)=>{const s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,t.length>=3&&t.shift(),[n,a]=t):[r,n,a]=t,gl(r,e,i),fl(n,e,i),yl(a,e,i),a=nl(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},bl=(e,t,i,s)=>{gl(e,e,t),e.nodeName?sl[t](e,i,s):e[t](i,s)},vl={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"on");if(bl(i,"on",s,r),!t){const e=()=>this.off(i,s,r);e.guid=r.guid;const t=()=>this.off("dispose",e);t.guid=r.guid,bl(this,"on","dispose",e),bl(i,"on","dispose",t)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"one");if(t)bl(i,"one",s,r);else{const e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,bl(i,"one",s,e)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=_l(this,e,"any");if(t)bl(i,"any",s,r);else{const e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,bl(i,"any",s,e)}},off(e,t,i){if(!e||ml(e))Zo(this.eventBusEl_,e,t);else{const s=e,r=t;gl(s,this,"off"),fl(r,this,"off"),yl(i,this,"off"),i=nl(this,i),this.off("dispose",i),s.nodeName?(Zo(s,r,i),Zo(s,"dispose",i)):cl(s)&&(s.off(r,i),s.off("dispose",i))}},trigger(e,t){gl(this.eventBusEl_,this,"trigger");const i=e&&"string"!=typeof e?e.type:e;if(!ml(i))throw new Error(`Invalid event type for ${hl(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return el(this.eventBusEl_,e,t)}};function Tl(e,t={}){const{eventBusKey:i}=t;if(i){if(!e[i].nodeName)throw new Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=lo("span",{className:"vjs-event-bus"});return Object.assign(e,vl),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Vo.has(e)&&Vo.delete(e)})),g.setTimeout((()=>{e.eventBusEl_=null}),0)})),e}const Sl={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),Aa(e,((e,i)=>{this.state[i]!==e&&(t=t||{},t[i]={from:this.state[i],to:e}),this.state[i]=e})),t&&cl(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function El(e,t){return Object.assign(e,Sl),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&cl(e)&&e.on("statechanged",e.handleStateChanged),e}const wl=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))},kl=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Cl=function(e,t){return kl(e)===kl(t)};var xl=Object.freeze({__proto__:null,toLowerCase:wl,toTitleCase:kl,titleCaseEquals:Cl});class Il{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Oa({},this.options_),t=this.options_=Oa(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${Go()}`}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((e=>this.addClass(e))),["on","off","one","any","trigger"].forEach((e=>{this[e]=void 0})),!1!==t.evented&&(Tl(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),El(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=Oa(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return lo(e,t,i)}localize(e,t,i=e){const s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],a=s&&s.split("-")[0],o=r&&r[a];let l=i;return n&&n[e]?l=n[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){const s=t[i-1];let r=s;return void 0===s&&(r=e),r}))),l}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce(((e,t)=>e.concat(t)),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}addChild(e,t={},i=this.children_.length){let s,r;if("string"==typeof e){r=kl(e);const i=t.componentClass||r;t.name=r;const n=Il.getComponent(i);if(!n)throw new Error(`Component ${i} does not exist`);if("function"!=typeof n)return null;s=new n(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(i,0,s),s.parentComponent_=this,"function"==typeof s.id&&(this.childIndex_[s.id()]=s),r=r||s.name&&kl(s.name()),r&&(this.childNameIndex_[r]=s,this.childNameIndex_[wl(r)]=s),"function"==typeof s.el&&s.el()){let e=null;this.children_[i+1]&&(this.children_[i+1].el_?e=this.children_[i+1].el_:no(this.children_[i+1])&&(e=this.children_[i+1])),this.contentEl().insertBefore(s.el(),e)}return s}removeChild(e){if("string"==typeof e&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[kl(e.name())]=null,this.childNameIndex_[wl(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=e=>{const i=e.name;let s=e.opts;if(void 0!==t[i]&&(s=t[i]),!1===s)return;!0===s&&(s={}),s.playerOptions=this.options_.playerOptions;const r=this.addChild(i,s);r&&(this[i]=r)};let s;const r=Il.getComponent("Tech");s=Array.isArray(e)?e:Object.keys(e),s.concat(Object.keys(this.options_).filter((function(e){return!s.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((t=>{let i,s;return"string"==typeof t?(i=t,s=e[i]||this.options_[i]||{}):(i=t.name,s=t),{name:i,opts:s}})).filter((e=>{const t=Il.getComponent(e.opts.componentClass||kl(e.name));return t&&!r.isTech(t)})).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)}$(e,t){return Po(e,t||this.contentEl())}$$(e,t){return Oo(e,t||this.contentEl())}hasClass(e){return co(this.el_,e)}addClass(...e){po(this.el_,...e)}removeClass(...e){mo(this.el_,...e)}toggleClass(e,t){go(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return _o(this.el_,e)}setAttribute(e,t){bo(this.el_,e,t)}removeAttribute(e){vo(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;const s=this.el_.style[e],r=s.indexOf("px");return-1!==r?parseInt(s.slice(0,r),10):parseInt(this.el_["offset"+kl(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=No(this.el_,e),t=parseFloat(t),0===t||isNaN(t)){const i=`offset${kl(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(w.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,s=200;let r;this.on("touchstart",(function(i){1===i.touches.length&&(t={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},e=g.performance.now(),r=!0)})),this.on("touchmove",(function(e){if(e.touches.length>1)r=!1;else if(t){const s=e.touches[0].pageX-t.pageX,n=e.touches[0].pageY-t.pageY;Math.sqrt(s*s+n*n)>i&&(r=!1)}}));const n=function(){r=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(i){if(t=null,!0===r){g.performance.now()-e<s&&(i.preventDefault(),this.trigger("tap"))}}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=nl(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",(function(){e(),this.clearInterval(t),t=this.setInterval(e,250)}));const i=function(i){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=nl(this,e),this.clearTimersOnDispose_(),i=g.setTimeout((()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),g.clearTimeout(e)),e}setInterval(e,t){e=nl(this,e),this.clearTimersOnDispose_();const i=g.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),g.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=nl(this,e),t=g.requestAnimationFrame((()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()})),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=nl(this,t);const i=this.requestAnimationFrame((()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}));return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),g.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((([e,t])=>{this[e].forEach(((e,i)=>this[t](i)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(e,t){if("string"!=typeof e||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=Il.getComponent("Tech"),s=i&&i.isTech(t),r=Il===t||Il.prototype.isPrototypeOf(t.prototype);if(s||!r){let t;throw t=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${e}"; ${t}.`)}e=kl(e),Il.components_||(Il.components_={});const n=Il.getComponent("Player");if("Player"===e&&n&&n.players){const e=n.players,t=Object.keys(e);if(e&&t.length>0&&t.map((t=>e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return Il.components_[e]=t,Il.components_[wl(e)]=t,t}static getComponent(e){if(e&&Il.components_)return Il.components_[e]}}function Al(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${t}) is non-numeric or out of bounds (0-${i}).`)}function Dl(e,t,i,s){return Al(e,s,i.length-1),i[s][t]}function Ll(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Dl.bind(null,"start",0,e),end:Dl.bind(null,"end",1,e)},g.Symbol&&g.Symbol.iterator&&(t[g.Symbol.iterator]=()=>(e||[]).values()),t}function Pl(e,t){return Array.isArray(e)?Ll(e):void 0===e||void 0===t?Ll():Ll([[e,t]])}Il.registerComponent("Component",Il);const Ol=function(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);const n=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=s=i="-"),r=r>0||a>0?r+":":"",s=((r||n>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,r+s+i};let Nl=Ol;function Rl(e){Nl=e}function Ml(){Nl=Ol}function Ul(e,t=e){return Nl(e,t)}var Bl=Object.freeze({__proto__:null,createTimeRanges:Pl,createTimeRange:Pl,setFormatTime:Rl,resetFormatTime:Ml,formatTime:Ul});function Fl(e,t){let i,s,r=0;if(!t)return 0;e&&e.length||(e=Pl(0,0));for(let n=0;n<e.length;n++)i=e.start(n),s=e.end(n),s>t&&(s=t),r+=s-i;return r/t}function jl(e){if(e instanceof jl)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:La(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=jl.defaultMessages[this.code]||"")}jl.prototype.code=0,jl.prototype.message="",jl.prototype.status=null,jl.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],jl.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let Yf=0;Yf<jl.errorTypes.length;Yf++)jl[jl.errorTypes[Yf]]=Yf,jl.prototype[jl.errorTypes[Yf]]=Yf;function ql(e){return null!=e&&"function"==typeof e.then}function $l(e){ql(e)&&e.then(null,(e=>{}))}const Vl=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((t,i,s)=>(e[i]&&(t[i]=e[i]),t)),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})};var Hl={textTracksToJson:function(e){const t=e.$$("track"),i=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){const t=Vl(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(Vl))},jsonToTextTracks:function(e,t){return e.forEach((function(e){const i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((e=>i.addCue(e)))})),t.textTracks()},trackToJson_:Vl};const Wl="vjs-modal-dialog";class Gl extends Il{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=lo("div",{className:`${Wl}-content`},{role:"document"}),this.descEl_=lo("p",{className:`${Wl}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),uo(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Wl} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(!this.opened_){const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if("boolean"==typeof e){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const e=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Do(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_)}empty(){this.trigger("beforemodalempty"),xo(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){const e=S.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),w.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(!w.isEventKey(e,"Tab"))return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let s;for(let r=0;r<t.length;r++)if(i===t[r]){s=r;break}S.activeElement===this.el_&&(s=0),e.shiftKey&&0===s?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||s!==t.length-1||(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(e=>(e instanceof g.HTMLAnchorElement||e instanceof g.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof g.HTMLInputElement||e instanceof g.HTMLSelectElement||e instanceof g.HTMLTextAreaElement||e instanceof g.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof g.HTMLIFrameElement||e instanceof g.HTMLObjectElement||e instanceof g.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")))}}Gl.prototype.options_={pauseOnOpen:!0,temporary:!0},Il.registerComponent("ModalDialog",Gl);class zl extends dl{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},cl(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const s=this[i];if(s.id===e){t=s;break}}return t}}zl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const Qf in zl.prototype.allowedEvents_)zl.prototype["on"+Qf]=null;const Xl=function(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)};class Kl extends zl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Xl(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Xl(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Xl(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Yl=function(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)};class Ql extends zl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Yl(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set(){}})}addTrack(e){e.selected&&Yl(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Yl(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Jl extends zl{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class Zl{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,s=this.trackElements_.length;i<s;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class eu{constructor(e){eu.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const s=e.length;this.cues_=e,this.length_=e.length;const r=function(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})};if(t<s)for(i=t;i<s;i++)r.call(this,i)}getCueById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const s=this[i];if(s.id===e){t=s;break}}return t}}const tu={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},iu={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},su={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},ru={disabled:"disabled",hidden:"hidden",showing:"showing"};class nu extends dl{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Go(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const s in t)Object.defineProperty(this,s,{get:()=>t[s],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}const au=function(e){const t=["protocol","hostname","port","pathname","search","hash","host"],i=S.createElement("a");i.href=e;const s={};for(let r=0;r<t.length;r++)s[t[r]]=i[t[r]];return"http:"===s.protocol&&(s.host=s.host.replace(/:80$/,"")),"https:"===s.protocol&&(s.host=s.host.replace(/:443$/,"")),s.protocol||(s.protocol=g.location.protocol),s.host||(s.host=g.location.host),s},ou=function(e){if(!e.match(/^https?:\/\//)){const t=S.createElement("a");t.href=e,e=t.href}return e},lu=function(e){if("string"==typeof e){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},uu=function(e,t=g.location){const i=au(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host};var du=Object.freeze({__proto__:null,parseUrl:au,getAbsoluteURL:ou,getFileExtension:lu,isCrossOrigin:uu});const hu=function(e,t){const i=new g.WebVTT.Parser(g,g.vttjs,g.WebVTT.StringDecoder()),s=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){s.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),s.length>0&&(g.console&&g.console.groupCollapsed&&g.console.groupCollapsed(`Text Track parsing errors for ${t.src}`),s.forEach((e=>ka.error(e))),g.console&&g.console.groupEnd&&g.console.groupEnd()),i.flush()},cu=function(e,t){const i={uri:e},s=uu(e);s&&(i.cors=s);const r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),z(i,nl(this,(function(e,i,s){if(e)return ka.error(e,i);t.loaded_=!0,"function"!=typeof g.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return hu(s,t);ka.error(`vttjs failed to load, stopping trying to process ${t.src}`)})):hu(s,t)})))};class pu extends nu{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Oa(e,{kind:su[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=ru[t.mode]||"disabled";const s=t.default;"metadata"!==t.kind&&"chapters"!==t.kind||(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;const r=new eu(this.cues_),n=new eu(this.activeCues_);let a=!1;this.timeupdateHandler=nl(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,a&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));const o=()=>{this.stopTracking()};this.tech_.one("dispose",o),"disabled"!==i&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>s,set(){}},mode:{get:()=>i,set(e){ru[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||cu(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return n;const e=this.tech_.currentTime(),t=[];for(let i=0,s=this.cues.length;i<s;i++){const s=this.cues[i];s.startTime<=e&&s.endTime>=e&&t.push(s)}if(a=!1,t.length!==this.activeCues_.length)a=!0;else for(let i=0;i<t.length;i++)-1===this.activeCues_.indexOf(t[i])&&(a=!0);return this.activeCues_=t,n.setCues_(this.activeCues_),n},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||"subtitles"!==t.kind&&"captions"!==t.kind)&&cu(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(g.vttjs&&!(e instanceof g.vttjs.VTTCue)){t=new g.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const i in e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let s=0;s<i.length;s++)i[s]!==this&&i[s].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}pu.prototype.allowedEvents_={cuechange:"cuechange"};class mu extends nu{constructor(e={}){const t=Oa(e,{kind:iu[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class gu extends nu{constructor(e={}){const t=Oa(e,{kind:tu[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class fu extends dl{constructor(e={}){let t;super();const i=new pu(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>i}}),t=fu.NONE,i.addEventListener("loadeddata",(()=>{t=fu.LOADED,this.trigger({type:"load",target:this})}))}}fu.prototype.allowedEvents_={load:"load"},fu.NONE=0,fu.LOADING=1,fu.LOADED=2,fu.ERROR=3;const yu={audio:{ListClass:Kl,TrackClass:mu,capitalName:"Audio"},video:{ListClass:Ql,TrackClass:gu,capitalName:"Video"},text:{ListClass:Jl,TrackClass:pu,capitalName:"Text"}};Object.keys(yu).forEach((function(e){yu[e].getterName=`${e}Tracks`,yu[e].privateName=`${e}Tracks_`}));const _u={remoteText:{ListClass:Jl,TrackClass:pu,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Zl,TrackClass:fu,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},bu=Object.assign({},yu,_u);function vu(e,t,i,s,r={}){const n=e.textTracks();r.kind=t,i&&(r.label=i),s&&(r.language=s),r.tech=e;const a=new bu.text.TrackClass(r);return n.addTrack(a),a}_u.names=Object.keys(_u),yu.names=Object.keys(yu),bu.names=[].concat(_u.names).concat(yu.names);class Tu extends Il{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",(function(){this.hasStarted_=!0})),this.on("loadstart",(function(){this.hasStarted_=!1})),bu.names.forEach((t=>{const i=bu[t];e&&e[i.getterName]&&(this[i.privateName]=e[i.getterName])})),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((t=>{!1===e[`native${t}Tracks`]&&(this[`featuresNative${t}Tracks`]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new bu.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",(()=>this.setTimeout((()=>this.triggerSourceset(e)),1))),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(nl(this,(function(){const e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Pl(0,0)}bufferedPercent(){return Fl(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(yu.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach((e=>{const t=this[`${e}Tracks`]()||[];let i=t.length;for(;i--;){const s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}}))}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new jl(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Pl(0,0):Pl()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){yu.names.forEach((e=>{const t=yu[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",(()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)}))}))}addWebVttScript_(){if(!g.WebVTT)if(S.body.contains(this.el())){if(!this.options_["vtt.js"]&&Pa(Fe)&&Object.keys(Fe).length>0)return void this.trigger("vttjsloaded");const e=S.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",(()=>{e.onload=null,e.onerror=null})),g.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),s=t=>e.removeTrack(t.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),n=()=>{r();for(let t=0;t<e.length;t++){const i=e[t];i.removeEventListener("cuechange",r),"showing"===i.mode&&i.addEventListener("cuechange",r)}};n(),e.addEventListener("change",n),e.addEventListener("addtrack",n),e.addEventListener("removetrack",n),this.on("dispose",(function(){t.off("addtrack",i),t.off("removetrack",s),e.removeEventListener("change",n),e.removeEventListener("addtrack",n),e.removeEventListener("removetrack",n);for(let t=0;t<e.length;t++){e[t].removeEventListener("cuechange",r)}}))}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return vu(this,e,t,i)}createRemoteTextTrack(e){const t=Oa(e,{tech:this});return new _u.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return"boolean"!=typeof t&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===t&&this.ready((()=>this.autoRemoteTextTracks_.addTrack(i.track))),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Go();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",(()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())}))):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Tu.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Tu||e instanceof Tu||e===Tu}static registerTech(e,t){if(Tu.techs_||(Tu.techs_={}),!Tu.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Tu.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Tu.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=kl(e),Tu.techs_[e]=t,Tu.techs_[wl(e)]=t,"Tech"!==e&&Tu.defaultTechOrder_.push(e),t}static getTech(e){if(e)return Tu.techs_&&Tu.techs_[e]?Tu.techs_[e]:(e=kl(e),g&&g.videojs&&g.videojs[e]?(ka.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),g.videojs[e]):void 0)}}bu.names.forEach((function(e){const t=bu[e];Tu.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Tu.prototype.featuresVolumeControl=!0,Tu.prototype.featuresMuteControl=!0,Tu.prototype.featuresFullscreenResize=!1,Tu.prototype.featuresPlaybackRate=!1,Tu.prototype.featuresProgressEvents=!1,Tu.prototype.featuresSourceset=!1,Tu.prototype.featuresTimeupdateEvents=!1,Tu.prototype.featuresNativeTextTracks=!1,Tu.prototype.featuresVideoFrameCallback=!1,Tu.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let s=e.sourceHandlers;s||(s=e.sourceHandlers=[]),void 0===i&&(i=s.length),s.splice(i,0,t)},e.canPlayType=function(t){const i=e.sourceHandlers||[];let s;for(let e=0;e<i.length;e++)if(s=i[e].canPlayType(t),s)return s;return""},e.selectSourceHandler=function(t,i){const s=e.sourceHandlers||[];let r;for(let e=0;e<s.length;e++)if(r=s[e].canHandleSource(t,i),r)return s[e];return null},e.canPlaySource=function(t,i){const s=e.selectSourceHandler(t,i);return s?s.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){const t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){let i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:ka.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Il.registerComponent("Tech",Tu),Tu.registerTech("Tech",Tu),Tu.defaultTechOrder_=[];const Su={},Eu={},wu={};function ku(e,t){Su[e]=Su[e]||[],Su[e].push(t)}function Cu(e,t,i){e.setTimeout((()=>Bu(t,Su[t.type],i,e)),1)}function xu(e,t){e.forEach((e=>e.setTech&&e.setTech(t)))}function Iu(e,t,i){return e.reduceRight(Nu(i),t[i]())}function Au(e,t,i,s){return t[i](e.reduce(Nu(i),s))}function Du(e,t,i,s=null){const r="call"+kl(i),n=e.reduce(Nu(r),s),a=n===wu,o=a?null:t[i](n);return Ru(e,i,o,a),o}const Lu={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Pu={setCurrentTime:1,setMuted:1,setVolume:1},Ou={play:1,pause:1};function Nu(e){return(t,i)=>t===wu?wu:i[e]?i[e](t):t}function Ru(e,t,i,s){for(let r=e.length-1;r>=0;r--){const n=e[r];n[t]&&n[t](s,i)}}function Mu(e){Eu[e.id()]=null}function Uu(e,t){const i=Eu[e.id()];let s=null;if(null==i)return s=t(e),Eu[e.id()]=[[t,s]],s;for(let r=0;r<i.length;r++){const[e,n]=i[r];e===t&&(s=n)}return null===s&&(s=t(e),i.push([t,s])),s}function Bu(e={},t=[],i,s,r=[],n=!1){const[a,...o]=t;if("string"==typeof a)Bu(e,Su[a],i,s,r,n);else if(a){const t=Uu(s,a);if(!t.setSource)return r.push(t),Bu(e,o,i,s,r,n);t.setSource(Object.assign({},e),(function(a,l){if(a)return Bu(e,o,i,s,r,n);r.push(t),Bu(l,e.type===l.type?o:Su[l.type],i,s,r,n)}))}else o.length?Bu(e,o,i,s,r,n):n?i(e,r):Bu(e,Su["*"],i,s,r,!0)}const Fu={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},ju=function(e=""){const t=lu(e);return Fu[t.toLowerCase()]||""},qu=(e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;const i=e.cache_.sources.filter((e=>e.src===t));if(i.length)return i[0].type;const s=e.$$("source");for(let r=0;r<s.length;r++){const e=s[r];if(e.type&&e.src&&e.src===t)return e.type}return ju(t)},$u=function(e){if(Array.isArray(e)){let t=[];e.forEach((function(e){e=$u(e),Array.isArray(e)?t=t.concat(e):La(e)&&t.push(e)})),e=t}else e="string"==typeof e&&e.trim()?[Vu({src:e})]:La(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[Vu(e)]:[];return e};function Vu(e){if(!e.type){const t=ju(e.src);t&&(e.type=t)}return e}class Hu extends Il{constructor(e,t,i){if(super(e,Oa({createEl:!1},t),i),t.playerOptions.sources&&0!==t.playerOptions.sources.length)e.src(t.playerOptions.sources);else for(let s=0,r=t.playerOptions.techOrder;s<r.length;s++){const t=kl(r[s]);let i=Tu.getTech(t);if(t||(i=Il.getComponent(t)),i&&i.isSupported()){e.loadTech_(t);break}}}}Il.registerComponent("MediaLoader",Hu);class Wu extends Il{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=e=>this.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&ka.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const s=lo(e,t,i);return s.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=lo("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,uo(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){w.isEventKey(e,"Space")||w.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Il.registerComponent("ClickableComponent",Wu);class Gu extends Wu{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return lo("div",{className:"vjs-poster"})}crossOrigin(e){if(void 0===e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null===e||"anonymous"===e||"use-credentials"===e?this.$("img")&&(this.$("img").crossOrigin=e):this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(lo("picture",{className:"vjs-poster",tabIndex:-1},{},lo("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?$l(this.player_.play()):this.player_.pause())}}Gu.prototype.crossorigin=Gu.prototype.crossOrigin,Il.registerComponent("PosterImage",Gu);const zu="#222",Xu="#ccc",Ku={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Yu(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Qu(e,t,i){try{e.style[t]=i}catch(Gf){return}}class Ju extends Il{constructor(e,t,i){super(e,t,i);const s=e=>this.updateDisplay(e);e.on("loadstart",(e=>this.toggleDisplay(e))),e.on("texttrackchange",s),e.on("loadedmetadata",(e=>this.preselectTrack(e))),e.ready(nl(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)return void this.hide();e.on("fullscreenchange",s),e.on("playerresize",s);const t=g.screen.orientation||g,i=g.screen.orientation?"change":"orientationchange";t.addEventListener(i,s),e.on("dispose",(()=>t.removeEventListener(i,s)));const r=this.options_.playerOptions.tracks||[];for(let e=0;e<r.length;e++)this.player_.addRemoteTextTrack(r[e],!0);this.preselectTrack()})))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let s,r,n;for(let a=0;a<t.length;a++){const o=t[a];i&&i.enabled&&i.language&&i.language===o.language&&o.kind in e?o.kind===i.kind?n=o:n||(n=o):i&&!i.enabled?(n=null,s=null,r=null):o.default&&("descriptions"!==o.kind||s?o.kind in e&&!r&&(r=o):s=o)}n?n.mode="showing":r?r.mode="showing":s&&(s.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){"function"==typeof g.WebVTT&&g.WebVTT.processCues(g,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const t=[];for(let i=0;i<e.length;++i){const s=e[i];"showing"===s.mode&&t.push(s)}return void this.updateForTrack(t)}let i=null,s=null,r=e.length;for(;r--;){const t=e[r];"showing"===t.mode&&("descriptions"===t.kind?i=t:s=t)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):i&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){const e=i[s];if(!e)continue;const r=e.displayState;if(t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&Qu(r.firstChild,"color",Yu(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Qu(r.firstChild,"backgroundColor",Yu(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Qu(r,"backgroundColor",Yu(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow=`2px 2px 3px ${zu}, 2px 2px 4px ${zu}, 2px 2px 5px ${zu}`:"raised"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${zu}, 2px 2px ${zu}, 3px 3px ${zu}`:"depressed"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${Xu}, 0 1px ${Xu}, -1px -1px ${zu}, 0 -1px ${zu}`:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow=`0 0 4px ${zu}, 0 0 4px ${zu}, 0 0 4px ${zu}, 0 0 4px ${zu}`)),t.fontPercent&&1!==t.fontPercent){const e=g.parseFloat(r.style.fontSize);r.style.fontSize=e*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=Ku[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof g.WebVTT||e.every((e=>!e.activeCues)))return;const t=[];for(let i=0;i<e.length;++i){const s=e[i];for(let e=0;e<s.activeCues.length;++e)t.push(s.activeCues[e])}g.WebVTT.processCues(g,t,this.el_);for(let i=0;i<e.length;++i){const t=e[i];for(let e=0;e<t.activeCues.length;++e){const s=t.activeCues[e].displayState;po(s,"vjs-text-track-cue","vjs-text-track-cue-"+(t.language?t.language:i)),t.language&&bo(s,"lang",t.language)}this.player_.textTrackSettings&&this.updateDisplayState(t)}}}Il.registerComponent("TextTrackDisplay",Ju);class Zu extends Il{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=lo("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}Il.registerComponent("LoadingSpinner",Zu);class ed extends Wu{createEl(e,t={},i={}){const s=lo("button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i));return s.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}addChild(e,t={}){const i=this.constructor.name;return ka.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),Il.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){w.isEventKey(e,"Space")||w.isEventKey(e,"Enter")?e.stopPropagation():super.handleKeyDown(e)}}Il.registerComponent("Button",ed);class td extends ed{constructor(e,t){super(e,t),this.mouseused_=!1,this.on("mousedown",(e=>this.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)return $l(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());const i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s)return void this.player_.tech(!0).focus();const r=()=>s.focus();ql(t)?t.then(r,(()=>{})):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}td.prototype.controlText_="Play Video",Il.registerComponent("BigPlayButton",td);class id extends ed{constructor(e,t){super(e,t),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){w.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Il.registerComponent("CloseButton",id);class sd extends ed{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.on(e,"play",(e=>this.handlePlay(e))),this.on(e,"pause",(e=>this.handlePause(e))),t.replay&&this.on(e,"ended",(e=>this.handleEnded(e)))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?$l(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}sd.prototype.controlText_="Play",Il.registerComponent("PlayToggle",sd);class rd extends Il{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],(e=>this.updateContent(e))),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=lo("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=lo("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ul(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(()=>{if(!this.contentEl_)return;let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,ka.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=S.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))})))}updateContent(e){}}rd.prototype.labelText_="Time",rd.prototype.controlText_="Time",Il.registerComponent("TimeDisplay",rd);class nd extends rd{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}nd.prototype.labelText_="Current Time",nd.prototype.controlText_="Current Time",Il.registerComponent("CurrentTimeDisplay",nd);class ad extends rd{constructor(e,t){super(e,t);const i=e=>this.updateContent(e);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}ad.prototype.labelText_="Duration",ad.prototype.controlText_="Duration",Il.registerComponent("DurationDisplay",ad);class od extends Il{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}Il.registerComponent("TimeDivider",od);class ld extends rd{constructor(e,t){super(e,t),this.on(e,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(lo("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"!=typeof this.player_.duration())return;let t;t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t)}}ld.prototype.labelText_="Remaining Time",ld.prototype.controlText_="Remaining Time",Il.registerComponent("RemainingTimeDisplay",ld);class ud extends Il{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=lo("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(lo("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(S.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}Il.registerComponent("LiveDisplay",ud);class dd extends ed{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=lo("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function hd(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}dd.prototype.controlText_="Seek to live, currently playing live",Il.registerComponent("SeekToLive",dd);var cd=Object.freeze({__proto__:null,clamp:hd});class pd extends Il{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Va||e.preventDefault(),To(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;So(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",(()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"}))),e}getProgress(){return Number(hd(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=ko(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){w.isEventKey(e,"Left")||w.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):w.isEventKey(e,"Right")||w.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}Il.registerComponent("Slider",pd);const md=(e,t)=>hd(e/t*100,0,100).toFixed(2)+"%";class gd extends Il{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",(e=>this.update(e)))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=lo("span",{className:"vjs-control-text"}),i=lo("span",{textContent:this.localize("Loaded")}),s=S.createTextNode(": ");return this.percentageEl_=lo("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",(()=>{const e=this.player_.liveTracker,t=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,n=md(s,i);this.percent_!==n&&(this.el_.style.width=n,uo(this.percentageEl_,n),this.percent_=n);for(let a=0;a<t.length;a++){const e=t.start(a),i=t.end(a);let n=r[a];n||(n=this.el_.appendChild(lo()),r[a]=n),n.dataset.start===e&&n.dataset.end===i||(n.dataset.start=e,n.dataset.end=i,n.style.left=md(e,s),n.style.width=md(i-e,s))}for(let a=r.length;a>t.length;a--)this.el_.removeChild(r[a-1]);r.length=t.length}))}}Il.registerComponent("LoadProgressBar",gd);class fd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const s=wo(this.el_),r=Eo(this.player_.el()),n=e.width*t;if(!r||!s)return;const a=e.left-r.left+n,o=e.width-n+(r.right-e.right);let l=s.width/2;a<l?l+=l-a:o<l&&(l=o),l<0?l=0:l>s.width&&(l=s.width),l=Math.round(l),this.el_.style.right=`-${l}px`,this.write(i)}write(e){uo(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let r;const n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const e=this.player_.liveTracker.liveWindow(),i=e-t*e;r=(i<1?"":"-")+Ul(i,e)}else r=Ul(i,n);this.update(e,t,r),s&&s()}))}}Il.registerComponent("TimeTooltip",fd);class yd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const i=this.getChild("timeTooltip");if(!i)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}yd.prototype.options_={children:[]},Za||Fa||yd.prototype.options_.children.push("timeTooltip"),Il.registerComponent("PlayProgressBar",yd);class _d extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,(()=>{this.el_.style.left=e.width*t+"px"}))}}_d.prototype.options_={children:["timeTooltip"]},Il.registerComponent("MouseTimeDisplay",_d);const bd=5,vd=12;class Td extends pd{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=nl(this,this.update),this.update=al(this.update_,rl),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in S&&"visibilityState"in S&&this.on(S,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===S.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,rl))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"===S.visibilityState)return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{const e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker;let s=this.player_.duration();i&&i.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ul(e,s),Ul(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Eo(this.el()),this.getProgress())})),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Lo(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Lo(e))return;let i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);const s=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(s>=.99)return void r.seekToLiveEdge();const e=r.seekableStart(),t=r.liveCurrentTime();if(i=e+s*r.liveWindow(),i>=t&&(i=t),i<=e&&(i=e+.1),i===1/0)return}else i=s*this.player_.duration(),i===this.player_.duration()&&(i-=.1);this.userSeek_(i)}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?$l(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+bd)}stepBack(){this.userSeek_(this.player_.currentTime()-bd)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(w.isEventKey(e,"Space")||w.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(w.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(w.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(w(e))){e.preventDefault(),e.stopPropagation();const i=10*(w.codes[w(e)]-w.codes[0])/100;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else w.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-bd*vd)):w.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+bd*vd)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in S&&"visibilityState"in S&&this.off(S,"visibilitychange",this.toggleVisibility_),super.dispose()}}Td.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Za||Fa||Td.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Il.registerComponent("SeekBar",Td);class Sd extends Il{constructor(e,t){super(e,t),this.handleMouseMove=al(nl(this,this.handleMouseMove),rl),this.throttledHandleMouseSeek=al(nl(this,this.handleMouseSeek),rl),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;const r=t.el(),n=wo(r);let a=ko(r,e).x;a=hd(a,0,1),s&&s.update(n,a),i&&i.update(n,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach((e=>e.disable&&e.disable())),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&$l(this.player_.play())}}enable(){this.children().forEach((e=>e.enable&&e.enable())),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Sd.prototype.options_={children:["seekBar"]},Il.registerComponent("ProgressControl",Sd);class Ed extends ed{constructor(e,t){super(e,t),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>{"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),this.hide()):this.show()})),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control ${super.buildCSSClass()}`}handlePictureInPictureEnabledChange(){S.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in g?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}Ed.prototype.controlText_="Picture-in-Picture",Il.registerComponent("PictureInPictureToggle",Ed);class wd extends ed{constructor(e,t){super(e,t),this.on(e,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===S[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}wd.prototype.controlText_="Fullscreen",Il.registerComponent("FullscreenToggle",wd);const kd=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))};class Cd extends Il{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}Il.registerComponent("VolumeLevel",Cd);class xd extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){const i=Eo(this.el_),s=Eo(this.player_.el()),r=e.width*t;if(!s||!i)return;const n=e.left-s.left+r,a=e.width-r+(s.right-e.right);let o=i.width/2;n<o?o+=o-n:a<o&&(o=a),o<0?o=0:o>i.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${s}%`)}write(e){uo(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,i,s.toFixed(0)),r&&r()}))}}Il.registerComponent("VolumeLevelTooltip",xd);class Id extends Il{constructor(e,t){super(e,t),this.update=al(nl(this,this.update),rl)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,(()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}Id.prototype.options_={children:["volumeLevelTooltip"]},Il.registerComponent("MouseVolumeLevelDisplay",Id);class Ad extends pd{constructor(e,t){super(e,t),this.on("slideractive",(e=>this.updateLastVolume_(e))),this.on(e,"volumechange",(e=>this.updateARIAAttributes(e))),e.ready((()=>this.updateARIAAttributes()))}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Lo(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),s=Eo(i),r=this.vertical();let n=ko(i,e);n=r?n.y:n.x,n=hd(n,0,1),t.update(s,n,r)}Lo(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}Ad.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Za||Fa||Ad.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Ad.prototype.playerEvent="volumechange",Il.registerComponent("VolumeBar",Ad);class Dd extends Il{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||Pa(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),kd(this,e),this.throttledHandleMouseMove=al(nl(this,this.handleMouseMove),rl),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",(e=>this.handleMouseDown(e))),this.on("touchstart",(e=>this.handleMouseDown(e))),this.on("mousemove",(e=>this.handleMouseMove(e))),this.on(this.volumeBar,["focus","slideractive"],(()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")})),this.on(this.volumeBar,["blur","sliderinactive"],(()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")}))}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Dd.prototype.options_={children:["volumeBar"]},Il.registerComponent("VolumeControl",Dd);const Ld=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))};class Pd extends ed{constructor(e,t){super(e,t),Ld(this,e),this.on(e,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){const e=i<.1?.1:i;this.player_.volume(e),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;Za&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),mo(this.el_,[0,1,2,3].reduce(((e,t)=>e+`${t?" ":""}vjs-vol-${t}`),"")),po(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Pd.prototype.controlText_="Mute",Il.registerComponent("MuteToggle",Pd);class Od extends Il{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||Pa(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],(e=>this.volumePanelState_(e))),this.on(this.muteToggle,"keyup",(e=>this.handleKeyPress(e))),this.on(this.volumeControl,"keyup",(e=>this.handleVolumeControlKeyUp(e))),this.on("keydown",(e=>this.handleKeyPress(e))),this.on("mouseover",(e=>this.handleMouseOver(e))),this.on("mouseout",(e=>this.handleMouseOut(e))),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){w.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Jo(S,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Zo(S,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){w.isEventKey(e,"Esc")&&this.handleMouseOut()}}Od.prototype.options_={children:["muteToggle","volumeControl"]},Il.registerComponent("VolumePanel",Od);class Nd extends ed{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;r=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Il.registerComponent("SkipForward",Nd);class Rd extends ed{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart();let r;r=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Rd.prototype.controlText_="Skip Backward",Il.registerComponent("SkipBackward",Rd);class Md extends Il{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",(e=>this.handleKeyDown(e))),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof Il&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Il&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=lo(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),Jo(t,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||S.activeElement;if(!this.children().some((e=>e.el()===t))){const e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter((t=>t.el()===e.target))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}}handleKeyDown(e){w.isEventKey(e,"Left")||w.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(w.isEventKey(e,"Right")||w.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}Il.registerComponent("Menu",Md);class Ud extends Il{constructor(e,t={}){super(e,t),this.menuButton_=new ed(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=ed.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",(e=>this.handleKeyDown(e))),this.on(this.menuButton_,"mouseenter",(()=>{this.addClass("vjs-hover"),this.menu.show(),Jo(S,"keyup",this.handleMenuKeyUp_)})),this.on("mouseleave",(e=>this.handleMouseLeave(e))),this.on("keydown",(e=>this.handleSubmenuKeyDown(e)))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Md(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=lo("li",{className:"vjs-menu-title",textContent:kl(this.options_.title),tabIndex:-1}),i=new Il(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}buildWrapperCSSClass(){let e="vjs-menu-button";!0===this.options_.inline?e+="-inline":e+="-popup";return`vjs-menu-button ${e} ${ed.prototype.buildCSSClass()} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),Zo(S,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),w.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(w.isEventKey(e,"Up")||w.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(w.isEventKey(e,"Esc")||w.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),w.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Za&&ao())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}Il.registerComponent("MenuButton",Ud);class Bd extends Ud{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const s=nl(this,this.update);i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),i.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",(function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s),i.removeEventListener("labelchange",s)}))}}Il.registerComponent("TrackButton",Bd);const Fd=["Tab","Esc","Up","Down","Right","Left"];class jd extends Wu{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i);return s.replaceChild(lo("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),s.querySelector(".vjs-icon-placeholder")),s}handleKeyDown(e){Fd.some((t=>w.isEventKey(e,t)))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}Il.registerComponent("MenuItem",jd);class qd extends jd{constructor(e,t){const i=t.track,s=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const r=(...e)=>{this.handleTracksChange.apply(this,e)},n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)})),void 0===s.onchange){let e;this.on(["tap","click"],(function(){if("object"!=typeof g.Event)try{e=new g.Event("change")}catch(t){}e||(e=S.createEvent("Event"),e.initEvent("change",!0,!0)),s.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let s=0;s<i.length;s++){const e=i[s];-1!==this.kinds.indexOf(e.kind)&&(e===t?"showing"!==e.mode&&(e.mode="showing"):"disabled"!==e.mode&&(e.mode="disabled"))}}handleTracksChange(e){const t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if("showing"===this.track.mode){const e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}Il.registerComponent("TextTrackMenuItem",qd);class $d extends qd{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(this.options_.kinds.indexOf(e.kind)>-1&&"showing"===e.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(["captions","descriptions","subtitles"].indexOf(e.kind)>-1&&"showing"===e.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}Il.registerComponent("OffTextTrackMenuItem",$d);class Vd extends Bd{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=qd){let i;this.label_&&(i=`${this.label_} off`),e.push(new $d(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r<s.length;r++){const i=s[r];if(this.kinds_.indexOf(i.kind)>-1){const s=new t(this.player_,{track:i,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass(`vjs-${i.kind}-menu-item`),e.push(s)}}return e}}Il.registerComponent("TextTrackButton",Vd);class Hd extends jd{constructor(e,t){const i=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r<s.endTime,super(e,t),this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}Il.registerComponent("ChaptersTrackMenuItem",Hd);class Wd extends Vd{constructor(e,t,i){super(e,t,i),this.selectCurrentItem_=()=>{this.items.forEach((e=>{e.selected(this.track_.activeCues[0]===e.cue)}))}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&"chapters"!==e.track.kind)return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(kl(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,s=t.length;i<s;i++){const s=t[i],r=new Hd(this.player_,{track:this.track_,cue:s});e.push(r)}return e}}Wd.prototype.kind_="chapters",Wd.prototype.controlText_="Chapters",Il.registerComponent("ChaptersButton",Wd);class Gd extends Vd{constructor(e,t,i){super(e,t,i);const s=e.textTracks(),r=nl(this,this.handleTracksChange);s.addEventListener("change",r),this.on("dispose",(function(){s.removeEventListener("change",r)}))}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let s=0,r=t.length;s<r;s++){const e=t[s];if(e.kind!==this.kind_&&"showing"===e.mode){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Gd.prototype.kind_="descriptions",Gd.prototype.controlText_="Descriptions",Il.registerComponent("DescriptionsButton",Gd);class zd extends Vd{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}zd.prototype.kind_="subtitles",zd.prototype.controlText_="Subtitles",Il.registerComponent("SubtitlesButton",zd);class Xd extends qd{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}Il.registerComponent("CaptionSettingsMenuItem",Xd);class Kd extends Vd{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Xd(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Kd.prototype.kind_="captions",Kd.prototype.controlText_="Captions",Il.registerComponent("CaptionsButton",Kd);class Yd extends qd{createEl(e,t,i){const s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(r.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(lo("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),s}}Il.registerComponent("SubsCapsMenuItem",Yd);class Qd extends Vd{constructor(e,t={}){super(e,t),this.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions"),this.menuButton_.controlText(kl(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Xd(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Yd),e}}Qd.prototype.kinds_=["captions","subtitles"],Qd.prototype.controlText_="Subtitles",Il.registerComponent("SubsCapsButton",Qd);class Jd extends jd{constructor(e,t){const i=t.track,s=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...e)=>{this.handleTracksChange.apply(this,e)};s.addEventListener("change",r),this.on("dispose",(()=>{s.removeEventListener("change",r)}))}createEl(e,t,i){const s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(r.appendChild(lo("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(lo("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const e=this.player_.audioTracks();for(let t=0;t<e.length;t++){const i=e[t];i!==this.track&&(i.enabled=i===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}Il.registerComponent("AudioTrackMenuItem",Jd);class Zd extends Bd{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t)}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const s=t[i];e.push(new Jd(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}Zd.prototype.controlText_="Audio Track",Il.registerComponent("AudioTrackButton",Zd);class eh extends jd{constructor(e,t){const i=t.rate,s=parseFloat(i,10);t.label=i,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=s,this.on(e,"ratechange",(e=>this.update(e)))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}eh.prototype.contentElType="button",Il.registerComponent("PlaybackRateMenuItem",eh);class th extends Ud{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(e=>this.updateVisibility(e))),this.on(e,"ratechange",(e=>this.updateLabel(e))),this.on(e,"playbackrateschange",(e=>this.handlePlaybackRateschange(e)))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=lo("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new eh(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}th.prototype.controlText_="Playback Rate",Il.registerComponent("PlaybackRateMenuButton",th);class ih extends Il{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Il.registerComponent("Spacer",ih);class sh extends ih{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Il.registerComponent("CustomControlSpacer",sh);class rh extends Il{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}rh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in S&&rh.prototype.options_.children.splice(rh.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Il.registerComponent("ControlBar",rh);class nh extends Gl{constructor(e,t){super(e,t),this.on(e,"error",(e=>this.open(e)))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}nh.prototype.options_=Object.assign({},Gl.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Il.registerComponent("ErrorDisplay",nh);const ah="vjs-text-track-settings",oh=["#000","Black"],lh=["#00F","Blue"],uh=["#0FF","Cyan"],dh=["#0F0","Green"],hh=["#F0F","Magenta"],ch=["#F00","Red"],ph=["#FFF","White"],mh=["#FF0","Yellow"],gh=["1","Opaque"],fh=["0.5","Semi-Transparent"],yh=["0","Transparent"],_h={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[oh,ph,ch,dh,lh,mh,hh,uh]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[gh,fh,yh]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ph,oh,ch,dh,lh,mh,hh,uh]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[gh,fh]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[yh,fh,gh]}};function bh(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}function vh(e,t){return bh(e.options[e.options.selectedIndex].value,t)}function Th(e,t,i){if(t)for(let s=0;s<e.options.length;s++)if(bh(e.options[s].value,i)===t){e.selectedIndex=s;break}}_h.windowColor.options=_h.backgroundColor.options;class Sh extends Gl{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=lo("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",(()=>{this.saveSettings(),this.close()})),this.on(this.$(".vjs-default-button"),"click",(()=>{this.setDefaults(),this.updateDisplay()})),Aa(_h,(e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){const s=_h[e],r=s.id.replace("%s",this.id_),n=[t,r].join(" ").trim();return[`<${i} id="${r}" class="${"label"===i?"vjs-label":""}">`,this.localize(s.label),`</${i}>`,`<select aria-labelledby="${n}">`].concat(s.options.map((e=>{const t=r+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${n} ${t}">`,this.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['<fieldset class="vjs-fg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",'<span class="vjs-text-color">',this.createElSelect_("color",e),"</span>",'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['<fieldset class="vjs-bg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text Background"),"</legend>",'<span class="vjs-bg-color">',this.createElSelect_("backgroundColor",e),"</span>",'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['<fieldset class="vjs-window vjs-track-setting">',`<legend id="${e}">`,this.localize("Caption Area Background"),"</legend>",'<span class="vjs-window-color">',this.createElSelect_("windowColor",e),"</span>",'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return lo("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return lo("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return lo("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Da(_h,((e,t,i)=>{const s=vh(this.$(t.selector),t.parser);return void 0!==s&&(e[i]=s),e}),{})}setValues(e){Aa(_h,((t,i)=>{Th(this.$(t.selector),e[i],t.parser)}))}setDefaults(){Aa(_h,(e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(g.localStorage.getItem(ah))}catch(t){ka.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?g.localStorage.setItem(ah,JSON.stringify(e)):g.localStorage.removeItem(ah)}catch(t){ka.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()}handleLanguagechange(){this.fill()}}Il.registerComponent("TextTrackSettings",Sh);class Eh extends Il{constructor(e,t){let i=t.ResizeObserver||g.ResizeObserver;null===t.ResizeObserver&&(i=!1);super(e,Oa({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||g.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=ol((()=>{this.resizeHandler()}),100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const e=this.debouncedHandler_;let t=this.unloadListener_=function(){Zo(this,"resize",e),Zo(this,"unload",t),t=null};Jo(this.el_.contentWindow,"unload",t),Jo(this.el_.contentWindow,"resize",e)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}Il.registerComponent("ResizeManager",Eh);const wh={trackingThreshold:20,liveTolerance:15};class kh extends Il{constructor(e,t){super(e,Oa(wh,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",(e=>this.handleDurationchange(e))),this.on(this.player_,"canplay",(()=>this.toggleTracking()))}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(g.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const s=this.liveCurrentTime(),r=this.player_.currentTime();let n=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-r)>this.options_.liveTolerance;this.timeupdateSeen_&&s!==1/0||(n=!1),n!==this.behindLiveEdge_&&(this.behindLiveEdge_=n,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,rl),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}Il.registerComponent("LiveTracker",kh);class Ch extends Il{constructor(e,t){super(e,t),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:lo("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Go()}`}),description:lo("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Go()}`})},lo("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{const s=this.state[e],r=this.els[e],n=i[e];xo(r),s&&uo(r,s),t&&(t.removeAttribute(n),s&&t.setAttribute(n,r.id))})),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}Il.registerComponent("TitleBar",Ch);const xh=e=>{const t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;const i=e.$$("source"),s=[];let r="";if(!i.length)return!1;for(let n=0;n<i.length;n++){const e=i[n].src;e&&-1===s.indexOf(e)&&s.push(e)}return!!s.length&&(1===s.length&&(r=s[0]),e.triggerSourceset(r),!0)},Ih=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){const t=S.createElement(this.nodeName.toLowerCase());t.innerHTML=e;const i=S.createDocumentFragment();for(;t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",g.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Ah=(e,t)=>{let i={};for(let s=0;s<e.length&&(i=Object.getOwnPropertyDescriptor(e[s],t),!(i&&i.set&&i.get));s++);return i.enumerable=!0,i.configurable=!0,i},Dh=e=>Ah([e.el(),g.HTMLMediaElement.prototype,g.Element.prototype,Ih],"innerHTML"),Lh=function(e){const t=e.el();if(t.resetSourceWatch_)return;const i={},s=Dh(e),r=i=>(...s)=>{const r=i.apply(t,s);return xh(e),r};["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",Oa(s,{set:r(s.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach((e=>{t[e]=i[e]})),Object.defineProperty(t,"innerHTML",s)},e.one("sourceset",t.resetSourceWatch_)},Ph=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ou(g.Element.prototype.getAttribute.call(this,"src")):""},set(e){return g.Element.prototype.setAttribute.call(this,"src",e),e}}),Oh=e=>Ah([e.el(),g.HTMLMediaElement.prototype,Ph],"src"),Nh=function(e){if(!e.featuresSourceset)return;const t=e.el();if(t.resetSourceset_)return;const i=Oh(e),s=t.setAttribute,r=t.load;Object.defineProperty(t,"src",Oa(i,{set:s=>{const r=i.set.call(t,s);return e.triggerSourceset(t.src),r}})),t.setAttribute=(i,r)=>{const n=s.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),n},t.load=()=>{const i=r.call(t);return xh(e)||(e.triggerSourceset(""),Lh(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):xh(e)||Lh(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}};class Rh extends Tu{constructor(e,t){super(e,t);const i=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,i&&(this.el_.currentSrc!==i.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const e=this.el_.childNodes;let t=e.length;const i=[];for(;t--;){const r=e[t];"track"===r.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),this.textTracks().addTrack(r.track),s||this.el_.hasAttribute("crossorigin")||!uu(r.src)||(s=!0)):i.push(r))}for(let s=0;s<i.length;s++)this.el_.removeChild(i[s])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s&&ka.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),this.restoreMetadataTracksInIOSNativePlayer_(),(Qa||Ya)&&!0===e.nativeControlsForTouch&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Rh.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Nh(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let i=0;i<e.length;i++){const s=e[i];"metadata"===s.kind&&t.push({track:s,storedMode:s.mode})}};i(),e.addEventListener("change",i),this.on("dispose",(()=>e.removeEventListener("change",i)));const s=()=>{for(let e=0;e<t.length;e++){const i=t[e];"disabled"===i.track.mode&&i.track.mode!==i.storedMode&&(i.track.mode=i.storedMode)}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",(()=>{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)})),this.on("webkitendfullscreen",(()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)}))}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach((e=>{this.el()[`${i}Tracks`].removeEventListener(e,this[`${i}TracksListeners_`][e])})),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=yu[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:t=>{const i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[_u.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},n=function(){const e=[];for(let t=0;t<s.length;t++){let r=!1;for(let e=0;e<i.length;e++)if(i[e]===s[t]){r=!0;break}r||e.push(s[t])}for(;e.length;)s.removeTrack(e.shift())};this[t.getterName+"Listeners_"]=r,Object.keys(r).forEach((e=>{const t=r[e];i.addEventListener(e,t),this.on("dispose",(s=>i.removeEventListener(e,t)))})),this.on("loadstart",n),this.on("dispose",(e=>this.off("loadstart",n)))}proxyNativeTracks_(){yu.names.forEach((e=>{this.proxyNativeTracksForType_(e)}))}createEl(){let e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){const t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),Rh.disposeMediaElement(e),e=t}else{e=S.createElement("video");const t=Oa({},this.options_.tag&&yo(this.options_.tag));Qa&&!0===this.options_.nativeControlsForTouch||delete t.controls,fo(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&bo(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const s=t[i],r=this.options_[s];void 0!==r&&(r?bo(e,s,s):vo(e,s),e[s]=r)}return e}handleLateInit_(e){if(0===e.networkState||3===e.networkState)return;if(0===e.readyState){let e=!1;const t=function(){e=!0};this.on("loadstart",t);const i=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",i),void this.ready((function(){this.off("loadstart",t),this.off("loadedmetadata",i),e||this.trigger("loadstart")}))}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready((function(){t.forEach((function(e){this.trigger(e)}),this)}))}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&eo?this.el_.fastSeek(e):this.el_.currentTime=e}catch(Gf){ka(Gf,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Fa&&Va&&0===this.el_.currentTime){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",(()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)}))}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)$l(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(Gf){this.trigger("fullscreenerror",Gf)}}),0);else try{e.webkitEnterFullScreen()}catch(Gf){this.trigger("fullscreenerror",Gf)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){Rh.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=S.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();const e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),g.performance&&(e.creationTime=g.performance.now()),e}}Na(Rh,"TEST_VID",(function(){if(!ro())return;const e=S.createElement("video"),t=S.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e})),Rh.isSupported=function(){try{Rh.TEST_VID.volume=.5}catch(Gf){return!1}return!(!Rh.TEST_VID||!Rh.TEST_VID.canPlayType)},Rh.canPlayType=function(e){return Rh.TEST_VID.canPlayType(e)},Rh.canPlaySource=function(e,t){return Rh.canPlayType(e.type)},Rh.canControlVolume=function(){try{const e=Rh.TEST_VID.volume;Rh.TEST_VID.volume=e/2+.1;const t=e!==Rh.TEST_VID.volume;return t&&Za?(g.setTimeout((()=>{Rh&&Rh.prototype&&(Rh.prototype.featuresVolumeControl=e!==Rh.TEST_VID.volume)})),!1):t}catch(Gf){return!1}},Rh.canMuteVolume=function(){try{const e=Rh.TEST_VID.muted;return Rh.TEST_VID.muted=!e,Rh.TEST_VID.muted?bo(Rh.TEST_VID,"muted","muted"):vo(Rh.TEST_VID,"muted","muted"),e!==Rh.TEST_VID.muted}catch(Gf){return!1}},Rh.canControlPlaybackRate=function(){if(Fa&&Va&&Wa<58)return!1;try{const e=Rh.TEST_VID.playbackRate;return Rh.TEST_VID.playbackRate=e/2+.1,e!==Rh.TEST_VID.playbackRate}catch(Gf){return!1}},Rh.canOverrideAttributes=function(){try{const e=()=>{};Object.defineProperty(S.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(S.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(S.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(S.createElement("audio"),"innerHTML",{get:e,set:e})}catch(Gf){return!1}return!0},Rh.supportsNativeTextTracks=function(){return eo||Za&&Va},Rh.supportsNativeVideoTracks=function(){return!(!Rh.TEST_VID||!Rh.TEST_VID.videoTracks)},Rh.supportsNativeAudioTracks=function(){return!(!Rh.TEST_VID||!Rh.TEST_VID.audioTracks)},Rh.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function([e,t]){Na(Rh.prototype,e,(()=>Rh[t]()),!0)})),Rh.prototype.featuresVolumeControl=Rh.canControlVolume(),Rh.prototype.movingMediaElementInDOM=!Za,Rh.prototype.featuresFullscreenResize=!0,Rh.prototype.featuresProgressEvents=!0,Rh.prototype.featuresTimeupdateEvents=!0,Rh.prototype.featuresVideoFrameCallback=!(!Rh.TEST_VID||!Rh.TEST_VID.requestVideoFrameCallback),Rh.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(Gf){}}()}},Rh.resetMediaElement=function(e){if(!e)return;const t=e.querySelectorAll("source");let i=t.length;for(;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(Gf){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Rh.prototype["set"+kl(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Rh.prototype["set"+kl(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Rh.prototype[e]=function(){return this.el_[e]()}})),Tu.withSourceHandlers(Rh),Rh.nativeSourceHandler={},Rh.nativeSourceHandler.canPlayType=function(e){try{return Rh.TEST_VID.canPlayType(e)}catch(Gf){return""}},Rh.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Rh.nativeSourceHandler.canPlayType(e.type);if(e.src){const t=lu(e.src);return Rh.nativeSourceHandler.canPlayType(`video/${t}`)}return""},Rh.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Rh.nativeSourceHandler.dispose=function(){},Rh.registerSourceHandler(Rh.nativeSourceHandler),Tu.registerTech("Html5",Rh);const Mh=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Uh={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Bh=["tiny","xsmall","small","medium","large","xlarge","huge"],Fh={};Bh.forEach((e=>{const t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;Fh[e]=`vjs-layout-${t}`}));const jh={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class qh extends Il{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Go()}`,(t=Object.assign(qh.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const i=e.closest("[lang]");i&&(t.language=i.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=Ca(this.id_),this.fsApi_=_a,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&yo(e),this.language(this.options_.language),t.languages){const e={};Object.getOwnPropertyNames(t.languages).forEach((function(i){e[i.toLowerCase()]=t.languages[i]})),this.languages_=e}else this.languages_=qh.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach((e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)})),this.scrubbing_=!1,this.el_=this.createEl(),Tl(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Jo(S,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=Oa(this.options_);t.plugins&&Object.keys(t.plugins).forEach((e=>{this[e](t.plugins[e])})),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),Qa&&this.addClass("vjs-touch-enabled"),Za||this.addClass("vjs-workinghover"),qh.players[this.id_]=this;const r=ca.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(e=>this.listenForUserActivity_(e))),this.on("keydown",(e=>this.handleKeyDown(e))),this.on("languagechange",(e=>this.handleLanguagechange(e))),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",(()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)}))}dispose(){this.trigger("dispose"),this.off("dispose"),Zo(S,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Zo(S,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),qh.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Mu(this),bu.names.forEach((e=>{const t=this[bu[e].getterName]();t&&t.off&&t.off()})),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,i=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div"));const r=yo(t);if(s){for(e=this.el_=t,t=this.tag=S.createElement("video");e.children.length;)t.appendChild(e.firstChild);co(e,"video-js")||po(e,"video-js"),e.appendChild(t),i=this.playerElIngest_=e,Object.keys(e).forEach((i=>{try{t[i]=e[i]}catch(Gf){}}))}if(t.setAttribute("tabindex","-1"),r.tabindex="-1",Va&&Xa&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach((function(i){s&&"class"===i||e.setAttribute(i,r[i]),s&&t.setAttribute(i,r[i])})),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused"),!0!==g.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=qo("vjs-styles-dimensions");const e=Po(".vjs-styles-defaults"),t=Po("head");t.insertBefore(this.styleEl_,e?e.nextSibling:t.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const n=t.getElementsByTagName("a");for(let a=0;a<n.length;a++){const e=n.item(a);po(e,"vjs-hidden"),e.setAttribute("hidden","hidden")}return t.initNetworkState_=t.networkState,t.parentNode&&!i&&t.parentNode.insertBefore(e,t),ho(t,e),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=e,e}crossOrigin(e){if(void 0===e)return this.techGet_("crossOrigin");null===e||"anonymous"===e||"use-credentials"===e?(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)):ka.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();const s=parseFloat(t);isNaN(s)?ka.error(`Improper value "${t}" supplied for for ${e}`):(this[i]=s,this.updateStyleEl_())}fluid(e){if(void 0===e)return!!this.fluid_;this.fluid_=!!e,cl(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),pl(this,(()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)}))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===g.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height,i=this.tech_&&this.tech_.el();return void(i&&(e>=0&&(i.width=e),t>=0&&(i.height=t)))}let e,t,i,s;i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";const r=i.split(":"),n=r[1]/r[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/n:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*n,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),$o(this.styleEl_,`\n .${s} {\n width: ${e}px;\n height: ${t}px;\n }\n\n .${s}.vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ${100*n}%;\n }\n `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=kl(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Tu.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(r=!1);const n={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_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};bu.names.forEach((e=>{const t=bu[e];n[t.getterName]=this[t.privateName]})),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(n.startTime=this.cache_.currentTime);const a=Tu.getTech(e);if(!a)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new a(n),this.tech_.ready(nl(this,this.handleTechReady_),!0),Hl.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Mh.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${kl(e)}_`](t)))})),Object.keys(Uh).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Uh[e]}_`].bind(this),event:t}):this[`handleTech${Uh[e]}_`](t)}))})),this.on(this.tech_,"loadstart",(e=>this.handleTechLoadStart_(e))),this.on(this.tech_,"sourceset",(e=>this.handleTechSourceset_(e))),this.on(this.tech_,"waiting",(e=>this.handleTechWaiting_(e))),this.on(this.tech_,"ended",(e=>this.handleTechEnded_(e))),this.on(this.tech_,"seeking",(e=>this.handleTechSeeking_(e))),this.on(this.tech_,"play",(e=>this.handleTechPlay_(e))),this.on(this.tech_,"pause",(e=>this.handleTechPause_(e))),this.on(this.tech_,"durationchange",(e=>this.handleTechDurationChange_(e))),this.on(this.tech_,"fullscreenchange",((e,t)=>this.handleTechFullscreenChange_(e,t))),this.on(this.tech_,"fullscreenerror",((e,t)=>this.handleTechFullscreenError_(e,t))),this.on(this.tech_,"enterpictureinpicture",(e=>this.handleTechEnterPictureInPicture_(e))),this.on(this.tech_,"leavepictureinpicture",(e=>this.handleTechLeavePictureInPicture_(e))),this.on(this.tech_,"error",(e=>this.handleTechError_(e))),this.on(this.tech_,"posterchange",(e=>this.handleTechPosterChange_(e))),this.on(this.tech_,"textdata",(e=>this.handleTechTextData_(e))),this.on(this.tech_,"ratechange",(e=>this.handleTechRateChange_(e))),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||ho(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){bu.names.forEach((e=>{const t=bu[e];this[t.privateName]=this[t.getterName]()})),this.textTracksJson_=Hl.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 void 0===e&&ka.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}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_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||"string"!=typeof e)return;const t=()=>{const e=this.muted();this.muted(!0);const t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);const i=this.play();if(ql(i))return i.catch((e=>{throw t(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)}))};let i;return"any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():t():(i=this.play(),ql(i)&&(i=i.catch(t))),ql(i)?i.then((()=>{this.trigger({type:"autoplay-success",autoplay:e})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:e})})):void 0}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=qu(this,t)),this.cache_.source=Oa({},e,{src:t,type:i});const s=this.cache_.sources.filter((e=>e.src&&e.src===t)),r=[],n=this.$$("source"),a=[];for(let o=0;o<n.length;o++){const e=yo(n[o]);r.push(e),e.src&&e.src===t&&a.push(e.src)}a.length&&!s.length?this.cache_.sources=r:s.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=e=>this.updateSourceCaches_(e);const i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],(e=>{if("sourceset"===e.type)return;const t=this.techGet("currentSrc");this.lastSource_.tech=t,this.updateSourceCaches_(t)}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((e=>e.callback(e.event))),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?$l(this.play()):this.pause()))}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(t=>t.contains(e.target)))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let s=S[this.fsApi_.fullscreenElement]===i;!s&&i.matches?s=i.matches(":"+this.fsApi_.fullscreen):!s&&i.msMatchesSelector&&(s=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(()=>{this.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready((function(){if(e in Pu)return Au(this.middleware_,this.tech_,e,t);if(e in Ou)return Du(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(Gf){throw ka(Gf),Gf}}),!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in Lu)return Iu(this.middleware_,this.tech_,e);if(e in Ou)return Du(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(Gf){if(void 0===this.tech_[e])throw ka(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,Gf),Gf;if("TypeError"===Gf.name)throw ka(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,Gf),this.tech_.isReady_=!1,Gf;throw ka(Gf),Gf}}}play(){return new Promise((e=>{this.play_(e)}))}play_(e=$l){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(eo||Za);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t)return this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!t&&i&&this.load());const s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===s?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Pl(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}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=Pl(0,0)),e}bufferedPercent(){return Fl(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){const t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise(((i,s)=>{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){r(),i()}function a(e,t){r(),s(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);const o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,s))}))}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){const e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise(((t,i)=>{function s(){e.off("fullscreenerror",n),e.off("fullscreenchange",r)}function r(){s(),t()}function n(e,t){s(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",n);const a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))}))}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=S[this.fsApi_.exitFullscreen]();return e&&$l(e.then((()=>this.isFullscreen(!1)))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=S.documentElement.style.overflow,Jo(S,"keydown",this.boundFullWindowOnEscKey_),S.documentElement.style.overflow="hidden",po(S.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){w.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Zo(S,"keydown",this.boundFullWindowOnEscKey_),S.documentElement.style.overflow=this.docOrigOverflow,mo(S.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&g.documentPictureInPicture){const e=S.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(lo("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),g.documentPictureInPicture.requestWindow({initialAspectRatio:this.videoWidth()/this.videoHeight(),copyStyleSheets:!0}).then((t=>(this.el_.parentNode.insertBefore(e,this.el_),t.document.body.append(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),t.addEventListener("unload",(t=>{const i=t.target.querySelector(".video-js");e.replaceWith(i),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")})),t)))}return"pictureInPictureEnabled"in S&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return g.documentPictureInPicture&&g.documentPictureInPicture.window?(g.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in S?S.exitPictureInPicture():void 0}handleKeyDown(e){const{userActions:t}=this.options_;if(!t||!t.hotkeys)return;(e=>{const t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=(e=>w.isEventKey(e,"f")),muteKey:s=(e=>w.isEventKey(e,"m")),playPauseKey:r=(e=>w.isEventKey(e,"k")||w.isEventKey(e,"Space"))}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const t=Il.getComponent("FullscreenToggle");!1!==S[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else if(s.call(this,e)){e.preventDefault(),e.stopPropagation();Il.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(r.call(this,e)){e.preventDefault(),e.stopPropagation();Il.getComponent("PlayToggle").prototype.handleClick.call(this,e)}}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i<s.length;i++){const r=s[i];let n=Tu.getTech(r);if(n||(n=Il.getComponent(r)),n){if(n.isSupported()&&(t=n.canPlayType(e),t))return t}else ka.error(`The "${r}" tech is undefined. Skipped browser support check for that tech.`)}return""}selectSource(e){const t=this.options_.techOrder.map((e=>[e,Tu.getTech(e)])).filter((([e,t])=>t?t.isSupported():(ka.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1))),i=function(e,t,i){let s;return e.some((e=>t.some((t=>{if(s=i(e,t),s)return!0})))),s};let s;const r=e=>(t,i)=>e(i,t),n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return s=this.options_.sourceOrder?i(e,t,r(n)):i(t,e,n),s||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=$u(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Cu(this,i[0],((e,s)=>{this.middleware_=s,t||(this.cache_.sources=i),this.updateSourceCaches_(e);if(this.src_(e))return i.length>1?this.handleSrc_(i.slice(1)):(this.changingSrc_=!1,this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void this.triggerReady());xu(s,this.tech_)})),i.length>1){const e=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return!t||(Cl(t.tech,this.techName_)?(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready((()=>{this.changingSrc_=!1})),!1))}load(){this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{$l(this.play().then((()=>this.doReset_())))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),cl(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")}loop(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")}poster(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}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(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(void 0===e)return this.error_||null;if(ma("beforeerror").forEach((t=>{const i=t(this,e);La(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){const t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new jl(e),this.addClass("vjs-error"),ka.error(`(CODE:${this.error_.code} ${jl.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),ma("error").forEach((e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const s=nl(this,this.reportUserActivity),r=function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,s())},n=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},a=function(t){s(),this.clearInterval(e)};this.on("mousedown",n),this.on("mousemove",r),this.on("mouseup",a),this.on("mouseleave",a);const o=this.getChild("controlBar");let l;!o||Za||Fa||(o.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),o.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",s),this.on("keyup",s),this.setInterval((function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(l);const e=this.options_.inactivityTimeout;e<=0||(l=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}),250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach((e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((e=>e.show())),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const e=[];return this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then((()=>this.enableAudioOnlyUI_()))}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){if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=e,e){if(this.audioOnlyMode()){return this.audioOnlyMode(!1).then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),cl(this)&&this.trigger("languagechange"))}languages(){return Oa(qh.prototype.options_.languages,this.languages_)}toJSON(){const e=Oa(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let s=t[i];s=Oa(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,t){(t=t||{}).content=e||"";const i=new Gl(this,t);return this.addChild(i),i.on("dispose",(()=>{this.removeChild(i)})),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<Bh.length;i++){const s=Bh[i];if(t<=this.breakpoints_[s]){if(e===s)return;e&&this.removeClass(Fh[e]),this.addClass(Fh[s]),this.breakpoint_=s;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Object.assign({},jh,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){if(void 0===e)return this.responsive_;return(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Fh[this.breakpoint_]||""}loadMedia(e,t){if(!e||"object"!=typeof e)return;this.reset(),this.cache_.media=Oa(e);const{artist:i,artwork:s,description:r,poster:n,src:a,textTracks:o,title:l}=this.cache_.media;!s&&n&&(this.cache_.media.artwork=[{src:n,type:ju(n)}]),a&&this.src(a),n&&this.poster(n),Array.isArray(o)&&o.forEach((e=>this.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:l,description:r||i||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(e=>({kind:e.kind,label:e.label,language:e.language,src:e.src})))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:ju(t.poster)}]),t}return Oa(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=yo(e),s=i["data-setup"];if(co(e,"vjs-fill")&&(i.fill=!0),co(e,"vjs-fluid")&&(i.fluid=!0),null!==s){const[e,t]=C(s||"{}");e&&ka.error(e),Object.assign(i,t)}if(Object.assign(t,i),e.hasChildNodes()){const i=e.childNodes;for(let e=0,s=i.length;e<s;e++){const s=i[e],r=s.nodeName.toLowerCase();"source"===r?t.sources.push(yo(s)):"track"===r&&t.tracks.push(yo(s))}}return t}debug(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((e=>"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}bu.names.forEach((function(e){const t=bu[e];qh.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),qh.prototype.crossorigin=qh.prototype.crossOrigin,qh.players={};const $h=g.navigator;qh.prototype.options_={techOrder:Tu.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:$h&&($h.languages&&$h.languages[0]||$h.userLanguage||$h.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){qh.prototype[e]=function(){return this.techGet_(e)}})),Mh.forEach((function(e){qh.prototype[`handleTech${kl(e)}_`]=function(){return this.trigger(e)}})),Il.registerComponent("Player",qh);const Vh="plugin",Hh="activePlugins_",Wh={},Gh=e=>Wh.hasOwnProperty(e),zh=e=>Gh(e)?Wh[e]:void 0,Xh=(e,t)=>{e[Hh]=e[Hh]||{},e[Hh][t]=!0},Kh=(e,t,i)=>{const s=(i?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},Yh=function(e,t){const i=function(){Kh(this,{name:e,plugin:t,instance:null},!0);const i=t.apply(this,arguments);return Xh(this,e),Kh(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i},Qh=(e,t)=>(t.prototype.name=e,function(...i){Kh(this,{name:e,plugin:t,instance:null},!0);const s=new t(...[this,...i]);return this[e]=()=>s,Kh(this,s.getEventHash()),s});class Jh{constructor(e){if(this.constructor===Jh)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Tl(this),delete this.trigger,El(this,this.constructor.defaultState),Xh(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return el(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Hh][e]=!1,this.player=this.state=null,t[e]=Qh(e,Wh[e])}static isBasic(e){const t="string"==typeof e?zh(e):e;return"function"==typeof t&&!Jh.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Gh(e))ka.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(qh.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Wh[e]=t,e!==Vh&&(Jh.isBasic(t)?qh.prototype[e]=Yh(e,t):qh.prototype[e]=Qh(e,t)),t}static deregisterPlugin(e){if(e===Vh)throw new Error("Cannot de-register base plugin.");Gh(e)&&(delete Wh[e],delete qh.prototype[e])}static getPlugins(e=Object.keys(Wh)){let t;return e.forEach((e=>{const i=zh(e);i&&(t=t||{},t[e]=i)})),t}static getPluginVersion(e){const t=zh(e);return t&&t.VERSION||""}}function Zh(e,t){let i=!1;return function(...s){return i||ka.warn(e),i=!0,t.apply(this,s)}}function ec(e,t,i,s){return Zh(`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s)}Jh.getPlugin=zh,Jh.BASE_PLUGIN_NAME=Vh,Jh.registerPlugin(Vh,Jh),qh.prototype.usingPlugin=function(e){return!!this[Hh]&&!0===this[Hh][e]},qh.prototype.hasPlugin=function(e){return!!Gh(e)};const tc=e=>0===e.indexOf("#")?e.slice(1):e;function ic(e,t,i){let s=ic.getPlayer(e);if(s)return t&&ka.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i),s;const r="string"==typeof e?Po("#"+tc(e)):e;if(!no(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||ka.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),ma("beforesetup").forEach((e=>{const i=e(r,Oa(t));La(i)&&!Array.isArray(i)?t=Oa(t,i):ka.error("please return an object in beforesetup hooks")}));const n=Il.getComponent("Player");return s=new n(r,t,i),ma("setup").forEach((e=>e(s))),s}if(ic.hooks_=pa,ic.hooks=ma,ic.hook=ga,ic.hookOnce=ya,ic.removeHook=fa,!0!==g.VIDEOJS_NO_DYNAMIC_STYLE&&ro()){let Jf=Po(".vjs-styles-defaults");if(!Jf){Jf=qo("vjs-styles-defaults");const Zf=Po("head");Zf&&Zf.insertBefore(Jf,Zf.firstChild),$o(Jf,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}Fo(1,ic),ic.VERSION=ca,ic.options=qh.prototype.options_,ic.getPlayers=()=>qh.players,ic.getPlayer=e=>{const t=qh.players;let i;if("string"==typeof e){const s=tc(e),r=t[s];if(r)return r;i=Po("#"+s)}else i=e;if(no(i)){const{player:e,playerId:s}=i;if(e||t[s])return e||t[s]}},ic.getAllPlayers=()=>Object.keys(qh.players).map((e=>qh.players[e])).filter(Boolean),ic.players=qh.players,ic.getComponent=Il.getComponent,ic.registerComponent=(e,t)=>{Tu.isTech(t)&&ka.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Il.registerComponent.call(Il,e,t)},ic.getTech=Tu.getTech,ic.registerTech=Tu.registerTech,ic.use=ku,Object.defineProperty(ic,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(ic.middleware,"TERMINATOR",{value:wu,writeable:!1,enumerable:!0}),ic.browser=to,ic.obj=Ra,ic.mergeOptions=ec(9,"videojs.mergeOptions","videojs.obj.merge",Oa),ic.defineLazyProperty=ec(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Na),ic.bind=ec(9,"videojs.bind","native Function.prototype.bind",nl),ic.registerPlugin=Jh.registerPlugin,ic.deregisterPlugin=Jh.deregisterPlugin,ic.plugin=(e,t)=>(ka.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Jh.registerPlugin(e,t)),ic.getPlugins=Jh.getPlugins,ic.getPlugin=Jh.getPlugin,ic.getPluginVersion=Jh.getPluginVersion,ic.addLanguage=function(e,t){return e=(""+e).toLowerCase(),ic.options.languages=Oa(ic.options.languages,{[e]:t}),ic.options.languages[e]},ic.log=ka,ic.createLogger=Ca,ic.time=Bl,ic.createTimeRange=ec(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Pl),ic.createTimeRanges=ec(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Pl),ic.formatTime=ec(9,"videojs.formatTime","videojs.time.formatTime",Ul),ic.setFormatTime=ec(9,"videojs.setFormatTime","videojs.time.setFormatTime",Rl),ic.resetFormatTime=ec(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Ml),ic.parseUrl=ec(9,"videojs.parseUrl","videojs.url.parseUrl",au),ic.isCrossOrigin=ec(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",uu),ic.EventTarget=dl,ic.any=il,ic.on=Jo,ic.one=tl,ic.off=Zo,ic.trigger=el,ic.xhr=z,ic.TextTrack=pu,ic.AudioTrack=mu,ic.VideoTrack=gu,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{ic[e]=function(){return ka.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ro[e].apply(null,arguments)}})),ic.computedStyle=ec(9,"videojs.computedStyle","videojs.dom.computedStyle",No),ic.dom=Ro,ic.fn=ll,ic.num=cd,ic.str=xl,ic.url=du;class sc{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class rc extends ic.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new sc(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const i=this[t];if(i.id===e)return i}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}rc.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const ey in rc.prototype.allowedEvents_)rc.prototype["on"+ey]=null;var nc="3.0.0";const ac=ic.registerPlugin||ic.plugin,oc=function(e,t){const i=e.qualityLevels,s=new rc,r=function(){s.dispose(),e.qualityLevels=i,e.off("dispose",r)};return e.on("dispose",r),e.qualityLevels=()=>s,e.qualityLevels.VERSION=nc,s},lc=function(e){return oc(this,ic.mergeOptions({},e))};ac("qualityLevels",lc),lc.VERSION=nc;const uc=Ve,dc=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,hc=e=>ic.log.debug?ic.log.debug.bind(ic,"VHS:",`${e} >`):function(){};function cc(...e){const t=ic.obj||ic;return(t.merge||t.mergeOptions).apply(t,e)}function pc(...e){const t=ic.time||ic;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}const mc=1/30,gc=3*mc,fc=function(e,t){const i=[];let s;if(e&&e.length)for(s=0;s<e.length;s++)t(e.start(s),e.end(s))&&i.push([e.start(s),e.end(s)]);return pc(i)},yc=function(e,t){return fc(e,(function(e,i){return e-gc<=t&&i+gc>=t}))},_c=function(e,t){return fc(e,(function(e){return e-mc>=t}))},bc=function(e){if(e.length<2)return pc();const t=[];for(let i=1;i<e.length;i++){const s=e.end(i-1),r=e.start(i);t.push([s,r])}return pc(t)},vc=function(e,t){let i=null,s=null,r=0;const n=[],a=[];if(!(e&&e.length&&t&&t.length))return pc();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort((function(e,t){return e.time-t.time})),o=0;o<n.length;o++)"start"===n[o].type?(r++,2===r&&(i=n[o].time)):"end"===n[o].type&&(r--,1===r&&(s=n[o].time)),null!==i&&null!==s&&(a.push([i,s]),i=null,s=null);return pc(a)},Tc=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},Sc=function(e,t,i=1){return((e.length?e.end(e.length-1):0)-t)/i},Ec=e=>{const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},wc=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1},kc=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},Cc=function(e,t){let i=0;if(!e||!e.length)return i;for(let s=0;s<e.length;s++){const r=e.start(s),n=e.end(s);t>n||(i+=t>r&&t<=n?n-t:n-r)}return i},xc=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},Ic=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(s,r){e.push({duration:s.duration,segmentIndex:i,partIndex:r,part:s,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),Ac=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},Dc=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:i}=e;let s=(i||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return s+=t&&t.length?t.length:0,s},Lc=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;const i=Ac(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Pc=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if(r=e.segments[s],void 0!==r.end)return{result:i+r.end,precise:!0};if(i+=xc(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},Oc=function(e,t){let i,s=0,r=t-e.mediaSequence;for(;r<e.segments.length;r++){if(i=e.segments[r],void 0!==i.start)return{result:i.start-s,precise:!0};if(s+=xc(e,i),void 0!==i.end)return{result:i.end-s,precise:!0}}return{result:-1,precise:!1}},Nc=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;const s=Pc(e,t);if(s.precise)return s.result;const r=Oc(e,t);return r.precise?r.result:s.result+i},Rc=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return g.Infinity}return Nc(e,t,i)},Mc=function({defaultDuration:e,durationList:t,startIndex:i,endIndex:s}){let r=0;if(i>s&&([i,s]=[s,i]),i<0){for(let t=i;t<Math.min(0,s);t++)r+=e;i=0}for(let n=i;n<s;n++)r+=t[n].duration;return r},Uc=function(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return Rc(e);if(null===t)return null;t=t||0;let r=Nc(e,e.mediaSequence+e.segments.length,t);return i&&(r-=s="number"==typeof s?s:Lc(null,e)),Math.max(0,r)},Bc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Fc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},jc=function(e){const t=Bc(e);return!e.disabled&&!t},qc=function(e,t){return t.attributes&&t.attributes[e]},$c=function(e,t,i,s=0){if(!qc("BANDWIDTH",i))return NaN;return(e*i.attributes.BANDWIDTH-8*s)/t},Vc=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!jc(e)&&(e.attributes.BANDWIDTH||0)<i)).length},Hc=(e,t)=>!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri)))),Wc=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const e in i[r])if(s=t(i[r][e]),s)break;if(s)break}return!!s},Gc=e=>{if(!e||!e.playlists||!e.playlists.length){return Wc(e,(e=>e.playlists&&e.playlists.length||e.uri))}for(let t=0;t<e.playlists.length;t++){const i=e.playlists[t],s=i.attributes&&i.attributes.CODECS;if(s&&s.split(",").every((e=>ct(e))))continue;if(!Wc(e,(e=>Hc(i,e))))return!1}return!0};var zc={liveEdgeDelay:Lc,duration:Rc,seekable:function(e,t,i){const s=t||0,r=Uc(e,t,!0,i);return null===r?pc():pc(s,r)},getMediaInfoForTime:function({playlist:e,currentTime:t,startingSegmentIndex:i,startingPartIndex:s,startTime:r,exactManifestTimings:n}){let a=t-r;const o=Ic(e);let l=0;for(let u=0;u<o.length;u++){const e=o[u];if(i===e.segmentIndex&&("number"!=typeof s||"number"!=typeof e.partIndex||s===e.partIndex)){l=u;break}}if(a<0){if(l>0)for(let t=l-1;t>=0;t--){const i=o[t];if(a+=i.duration,n){if(a<0)continue}else if(a+mc<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r-Mc({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(l<0){for(let i=l;i<0;i++)if(a-=e.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let u=l;u<o.length;u++){const t=o[u];if(a-=t.duration,n){if(a>0)continue}else if(a-mc>=0)continue;return{partIndex:t.partIndex,segmentIndex:t.segmentIndex,startTime:r+Mc({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:u})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:jc,isDisabled:function(e){return e.disabled},isExcluded:Bc,isIncompatible:Fc,playlistEnd:Uc,isAes:function(e){for(let t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:qc,estimateSegmentRequestTime:$c,isLowestEnabledRendition:Vc,isAudioOnly:Gc,playlistMatch:Hc,segmentDurationWithParts:xc};const{log:Xc}=ic,Kc=(e,t)=>`${e}-${t}`,Yc=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,Qc=({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{const a=new st;e&&a.on("warn",e),t&&a.on("info",t),s.forEach((e=>a.addParser(e))),r.forEach((e=>a.addTagMapper(e))),a.push(i),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),e&&e(`manifest has no targetDuration defaulting to ${t}`),o.targetDuration=t}const l=Ac(o);if(l.length&&!o.partTargetDuration){const t=l.reduce(((e,t)=>Math.max(e,t.duration)),0);e&&(e(`manifest has no partTargetDuration defaulting to ${t}`),Xc.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=t}return o},Jc=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const s in e.mediaGroups[i])for(const r in e.mediaGroups[i][s]){const n=e.mediaGroups[i][s][r];t(n,i,s,r)}}))},Zc=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},ep=e=>{let t=e.playlists.length;for(;t--;){const i=e.playlists[t];Zc({playlist:i,id:Kc(t,i.uri)}),i.resolvedUri=uc(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||Xc.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},tp=e=>{Jc(e,(t=>{t.uri&&(t.resolvedUri=uc(e.uri,t.uri))}))},ip=(e,t)=>{const i=Kc(0,t),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:g.location.href,resolvedUri:g.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[t]=s.playlists[0],s},sp=(e,t,i=Yc)=>{e.uri=t;for(let r=0;r<e.playlists.length;r++)if(!e.playlists[r].uri){const t=`placeholder-uri-${r}`;e.playlists[r].uri=t}const s=Gc(e);Jc(e,((t,r,n,a)=>{if(!t.playlists||!t.playlists.length){if(s&&"AUDIO"===r&&!t.uri)for(let t=0;t<e.playlists.length;t++){const i=e.playlists[t];if(i.attributes&&i.attributes.AUDIO&&i.attributes.AUDIO===n)return}t.playlists=[He({},t)]}t.playlists.forEach((function(t,s){const o=i(r,n,a,t),l=Kc(s,o);t.uri?t.resolvedUri=t.resolvedUri||uc(e.uri,t.uri):(t.uri=0===s?o:l,t.resolvedUri=t.uri),t.id=t.id||l,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),ep(e),tp(e)},{EventTarget:rp}=ic,np=(e,t)=>{if(t.endList||!t.serverControl)return e;const i={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let s=t.mediaSequence+t.segments.length;if(e){const r=e.parts||[],n=Dc(t)-1;n>-1&&n!==r.length-1&&(i._HLS_part=n),(n>-1||r.length)&&s--}i._HLS_msn=s}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const t=new g.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])})),e=t.toString()}return e},ap=(e,t)=>{if(!e)return t;const i=cc(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let s=0;s<t.parts.length;s++)e.parts&&e.parts[s]&&(i.parts[s]=cc(e.parts[s],t.parts[s]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},op=(e,t,i)=>{const s=e.slice(),r=t.slice();i=i||0;const n=[];let a;for(let o=0;o<r.length;o++){const e=s[o+i],t=r[o];e?(a=e.map||a,n.push(ap(e,t))):(a&&!t.map&&(t.map=a),n.push(t))}return n},lp=(e,t)=>{!e.resolvedUri&&e.uri&&(e.resolvedUri=uc(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=uc(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=uc(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=uc(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=uc(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=uc(t,e.uri))}))},up=function(e){const t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;e<i.preloadHints.length;e++)if("MAP"===i.preloadHints[e].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t},dp=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,hp=(e,t,i=dp)=>{const s=cc(e,{}),r=s.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=up(t);const n=cc(r,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e<t.skip.skippedSegments;e++)t.segments.unshift({skipped:!0})}n.segments=op(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}n.segments.forEach((e=>{lp(e,n.resolvedUri)}));for(let a=0;a<s.playlists.length;a++)s.playlists[a].id===t.id&&(s.playlists[a]=n);return s.playlists[t.id]=n,s.playlists[t.uri]=n,Jc(e,((e,i,s,r)=>{if(e.playlists)for(let a=0;a<e.playlists.length;a++)t.id===e.playlists[a].id&&(e.playlists[a]=n)})),s},cp=(e,t)=>{const i=e.segments||[],s=i[i.length-1],r=s&&s.parts&&s.parts[s.parts.length-1],n=r&&r.duration||s&&s.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)};class pp extends rp{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=hc("PlaylistLoader");const{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=uc(this.main.uri,e.uri);this.llhls&&(t=np(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,i){const{uri:s,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return Qc({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";const r=t||this.parseManifest_({url:i,manifestString:e});r.lastRequest=Date.now(),Zc({playlist:r,uri:i,id:s});const n=hp(this.main,r);this.targetDuration=r.partTargetDuration||r.targetDuration,this.pendingMedia_=null,n?(this.main=n,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(cp(this.media(),!!n)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),g.clearTimeout(this.mediaUpdateTimeout),g.clearTimeout(this.finalRenditionTimeout),this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(g.clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=g.setTimeout(this.media.bind(this,e,!1),t))}const i=this.state,s=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(s&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(cp(e,!0)),s){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},((t,s)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=dc(e.resolvedUri,s),t)return this.playlistRequestError(this.request,e,i);this.haveMetadata({playlistString:s.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}pause(){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=g.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=g.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=g.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=dc(this.src,t);const i=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(i)}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,sp(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=up(e),e.segments.forEach((t=>{lp(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||g.location.href;this.main=ip(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:mp}=ic,gp=function(e,t,i,s){const r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),s(t,e)},fp=function(){const e=function e(t,i){t=cc({timeout:45e3},t);const s=e.beforeRequest||ic.Vhs.xhr.beforeRequest;if(s&&"function"==typeof s){const e=s(t);e&&(t=e)}const r=(!0===ic.Vhs.xhr.original?mp:ic.Vhs.xhr)(t,(function(e,t){return gp(r,e,t,i)})),n=r.abort;return r.abort=function(){return r.aborted=!0,n.apply(r,arguments)},r.uri=t.uri,r.requestTime=Date.now(),r};return e.original=!0,e},yp=function(e){let t;const i=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?g.BigInt(e.offset)+g.BigInt(e.length)-g.BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t},_p=function(e){const t={};return e.byterange&&(t.Range=yp(e.byterange)),t},bp=function(e,t){return e.start(t)+"-"+e.end(t)},vp=function(e,t){const i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Tp=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Sp=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];wt(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t},Ep=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},wp=function(e){return e.resolvedUri},kp=e=>{const t=Array.prototype.slice.call(e),i=16;let s,r,n="";for(let a=0;a<t.length/i;a++)s=t.slice(a*i,a*i+i).map(vp).join(""),r=t.slice(a*i,a*i+i).map(Tp).join(""),n+=s+" "+r+"\n";return n},Cp=({bytes:e})=>kp(e),xp=e=>{let t,i="";for(t=0;t<e.length;t++)i+=bp(e,t)+" ";return i};var Ip=Object.freeze({__proto__:null,createTransferableMessage:Sp,initSegmentId:Ep,segmentKeyId:wp,hexDump:kp,tagDump:Cp,textRanges:xp});const Ap=.25,Dp=(e,t)=>{if(!t.dateTimeObject)return null;const i=t.videoTimingInfo.transmuxerPrependedSeconds,s=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*s)},Lp=e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,Pp=(e,t)=>{let i;try{i=new Date(e)}catch(Gf){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(i<s.dateTimeObject)return null;for(let o=0;o<t.segments.length-1;o++){s=t.segments[o];if(i<t.segments[o+1].dateTimeObject)break}const r=t.segments[t.segments.length-1],n=r.dateTimeObject,a=r.videoTimingInfo?Lp(r.videoTimingInfo):r.duration+r.duration*Ap;return i>new Date(n.getTime()+1e3*a)?null:(i>n&&(s=r),{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:zc.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"})},Op=(e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,s=0;for(let n=0;n<t.segments.length&&(i=t.segments[n],s=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:s+i.duration,!(e<=s));n++);const r=t.segments[t.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>s){if(e>s+r.duration*Ap)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Np=(e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(Gf){}const r=i.getTime();return(s.getTime()-r)/1e3},Rp=e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t<e.segments.length;t++){if(!e.segments[t].dateTimeObject)return!1}return!0},Mp=({playlist:e,time:t,callback:i})=>{if(!i)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});const s=Op(t,e);if(!s)return i({message:"valid programTime was not found"});if("estimate"===s.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});const r={mediaSeconds:t},n=Dp(t,s.segment);return n&&(r.programDateTime=n.toISOString()),i(null,r)},Up=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!s)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Rp(t))return a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});const o=Pp(e,t);if(!o)return a({message:`${e} was not found in the stream`});const l=o.segment,u=Np(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(s(o.estimatedStart+u),void n.one("seeked",(()=>{Up({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})));const d=l.start+u,h=()=>a(null,n.currentTime());n.one("seeked",h),r&&n.pause(),s(d)},Bp=(e,t)=>{if(4===e.readyState)return t()},Fp=(e,t,i)=>{let s,r=[],n=!1;const a=function(e,t,s,r){return t.abort(),n=!0,i(e,t,s,r)},o=function(e,t){if(n)return;if(e)return a(e,t,"",r);const i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=Pt(r,Lt(i,!0)),s=s||Pn(r),r.length<10||s&&r.length<s+2)return Bp(t,(()=>a(e,t,"",r)));const o=la(r);return"ts"===o&&r.length<188||!o&&r.length<376?Bp(t,(()=>a(e,t,"",r))):a(null,t,o,r)},l={uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:i}){return gp(e,null,{statusCode:e.status},o)}))}},u=t(l,(function(e,t){return gp(u,e,t,o)}));return u},{EventTarget:jp}=ic,qp=function(e,t){if(!dp(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i<e.segments.length;i++){const s=e.segments[i],r=t.segments[i];if(s.uri!==r.uri)return!1;if(!s.byterange&&!r.byterange)continue;const n=s.byterange,a=r.byterange;if(n&&!a||!n&&a)return!1;if(n.offset!==a.offset||n.length!==a.length)return!1}return!0},$p=(e,t,i,s)=>`placeholder-uri-${e}-${t}-${s.attributes.NAME||i}`,Vp=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{const n=kn(e,{manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r});return sp(n,t,$p),n},Hp=(e,t)=>{Jc(e,((i,s,r,n)=>{n in t.mediaGroups[s][r]||delete e.mediaGroups[s][r][n]}))},Wp=(e,t,i)=>{let s=!0,r=cc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let n=0;n<t.playlists.length;n++){const e=t.playlists[n];if(e.sidx){const t=Lr(e.sidx);i&&i[t]&&i[t].sidx&&Sr(e,i[t].sidx,e.sidx.resolvedUri)}const a=hp(r,e,qp);a&&(r=a,s=!1)}return Jc(t,((e,t,i,n)=>{if(e.playlists&&e.playlists.length){const a=e.playlists[0].id,o=hp(r,e.playlists[0],qp);o&&(r=o,n in r.mediaGroups[t][i]||(r.mediaGroups[t][i][n]=e),r.mediaGroups[t][i][n].playlists[0]=r.playlists[a],s=!1)}})),Hp(r,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(s=!1),s?null:r},Gp=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,zp=(e,t)=>{const i={};for(const s in e){const r=e[s].sidx;if(r){const e=Lr(r);if(!t[e])break;const s=t[e].sidxInfo;Gp(s,r)&&(i[e]=t[e])}}return i},Xp=(e,t)=>{let i=zp(e.playlists,t);return Jc(e,((e,s,r,n)=>{if(e.playlists&&e.playlists.length){const s=e.playlists;i=cc(i,zp(s,t))}})),i};class Kp extends jp{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,!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_=hc("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){const s=e.sidx&&Lr(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s])return void(this.mediaRequest_=g.setTimeout((()=>i(!1)),0));const r=dc(e.sidx.resolvedUri),n=(r,n)=>{if(this.requestErrored_(r,n,t))return;const a=this.mainPlaylistLoader_.sidxMapping_;let o;try{o=An(Ct(n.response).subarray(8))}catch(Gf){return void this.requestErrored_(Gf,n,t)}return a[s]={sidxInfo:e.sidx,sidx:o},Sr(e,o,e.sidx.resolvedUri),i(!0)};this.request=Fp(r,this.vhs_.xhr,((t,i,s,a)=>{if(t)return n(t,i);if(!s||"mp4"!==s)return n({status:i.status,message:`Unsupported ${s||"unknown"} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);const{offset:o,length:l}=e.sidx.byterange;if(a.length>=l+o)return n(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",headers:_p({byterange:e.sidx.byterange})},n)}))}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},g.clearTimeout(this.minimumUpdatePeriodTimeout_),g.clearTimeout(this.mediaRequest_),g.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("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(i=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(g.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){g.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=g.setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=g.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,i)=>{if(this.requestErrored_(t,i))return void("HAVE_NOTHING"===this.state&&(this.started=!1));const s=i.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=dc(this.mainPlaylistLoader_.srcUrl,i),s?(this.handleMain_(),void this.syncClientServerClock_((()=>e(i,s)))):e(i,s)}))}syncClientServerClock_(e){const t=Cn(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:uc(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((i,s)=>{if(!this.request)return;if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let r;r="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let t=Vp({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=Wp(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(g.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=g.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=Xp(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=g.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),cp(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}}var Yp={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 Qp=e=>{const t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer},Jp=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Zp=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(Gf){const i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}},em=function(e){return function(){const t=Zp(e),i=Jp(new Worker(t));i.objURL=t;const s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),s.call(this)},i}},tm=function(e){return`var browserWorkerPolyFill = ${Jp.toString()};\nbrowserWorkerPolyFill(self);\n`+e},im=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},sm=tm(im((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var s;return!!e[t]&&(s=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(s,1),s>-1)},this.trigger=function(t){var i,s,r,n;if(i=e[t])if(2===arguments.length)for(r=i.length,s=0;s<r;++s)i[s].call(this,arguments[1]);else{for(n=[],s=arguments.length,s=1;s<arguments.length;++s)n.push(arguments[s]);for(r=i.length,s=0;s<r;++s)i[s].apply(this,n)}},this.dispose=function(){e={}}}};t.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},t.prototype.push=function(e){this.trigger("data",e)},t.prototype.flush=function(e){this.trigger("done",e)},t.prototype.partialFlush=function(e){this.trigger("partialdone",e)},t.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},t.prototype.reset=function(e){this.trigger("reset",e)};var i,s,r,n,a,o,l,u,d,h,c,p,m,g,f,y,_,b,v,T,S,E,w,k,C,x,I,A,D,L,P,O,N,R,M,U,B,F,j,q,$=t,V=Math.pow(2,32),H={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*V+i.getUint32(4)},MAX_UINT32:V},W=H.MAX_UINT32;!function(){var e;if(E={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in E)E.hasOwnProperty(e)&&(E[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),C=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),k=new Uint8Array([0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),I=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:x,audio:I},P=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),O=new Uint8Array([0,0,0,0,0,0,0,0]),N=O,R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=O,D=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),i=function(e){var t,i,s=[],r=0;for(t=1;t<arguments.length;t++)s.push(arguments[t]);for(t=s.length;t--;)r+=s[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<s.length;t++)i.set(s[t],r),r+=s[t].byteLength;return i},s=function(){return i(E.dinf,i(E.dref,P))},r=function(e){return i(E.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},f=function(e){return i(E.hdlr,A[e])},g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),i(E.mdhd,t)},m=function(e){return i(E.mdia,g(e),f(e.type),o(e))},a=function(e){return i(E.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return i(E.minf,"video"===e.type?i(E.vmhd,D):i(E.smhd,L),s(),_(e))},l=function(e,t){for(var s=[],r=t.length;r--;)s[r]=v(t[r]);return i.apply(null,[E.moof,a(e)].concat(s))},u=function(e){for(var t=e.length,s=[];t--;)s[t]=c(e[t]);return i.apply(null,[E.moov,h(4294967295)].concat(s).concat(d(e)))},d=function(e){for(var t=e.length,s=[];t--;)s[t]=T(e[t]);return i.apply(null,[E.mvex].concat(s))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(E.mvhd,t)},y=function(e){var t,s,r=e.samples||[],n=new Uint8Array(4+r.length);for(s=0;s<r.length;s++)t=r[s].flags,n[s+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return i(E.sdtp,n)},_=function(e){return i(E.stbl,b(e),i(E.stts,M),i(E.stsc,N),i(E.stsz,R),i(E.stco,O))},b=function(e){return i(E.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?U(e):B(e))},U=function(e){var t,s,r=e.sps||[],n=e.pps||[],a=[],o=[];for(t=0;t<r.length;t++)a.push((65280&r[t].byteLength)>>>8),a.push(255&r[t].byteLength),a=a.concat(Array.prototype.slice.call(r[t]));for(t=0;t<n.length;t++)o.push((65280&n[t].byteLength)>>>8),o.push(255&n[t].byteLength),o=o.concat(Array.prototype.slice.call(n[t]));if(s=[E.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(E.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[n.length],o))),i(E.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];s.push(i(E.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return i.apply(null,s)},B=function(e){return i(E.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return i(E.tkhd,t)},v=function(e){var t,s,r,n,a,o,l;return t=i(E.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(e.baseMediaDecodeTime/W),l=Math.floor(e.baseMediaDecodeTime%W),s=i(E.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l])),a=92,"audio"===e.type?(r=S(e,a),i(E.traf,t,s,r)):(n=y(e),r=S(e,n.length+a),i(E.traf,t,s,r,n))},c=function(e){return e.duration=e.duration||4294967295,i(E.trak,p(e),m(e))},T=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),i(E.trex,t)},q=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(n=8)),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},j=function(e,t){var s,r,n,a,o,l;for(t+=20+16*(a=e.samples||[]).length,n=q(a,t),(r=new Uint8Array(n.length+16*a.length)).set(n),s=n.length,l=0;l<a.length;l++)o=a[l],r[s++]=(4278190080&o.duration)>>>24,r[s++]=(16711680&o.duration)>>>16,r[s++]=(65280&o.duration)>>>8,r[s++]=255&o.duration,r[s++]=(4278190080&o.size)>>>24,r[s++]=(16711680&o.size)>>>16,r[s++]=(65280&o.size)>>>8,r[s++]=255&o.size,r[s++]=o.flags.isLeading<<2|o.flags.dependsOn,r[s++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[s++]=61440&o.flags.degradationPriority,r[s++]=15&o.flags.degradationPriority,r[s++]=(4278190080&o.compositionTimeOffset)>>>24,r[s++]=(16711680&o.compositionTimeOffset)>>>16,r[s++]=(65280&o.compositionTimeOffset)>>>8,r[s++]=255&o.compositionTimeOffset;return i(E.trun,r)},F=function(e,t){var s,r,n,a,o,l;for(t+=20+8*(a=e.samples||[]).length,n=q(a,t),(s=new Uint8Array(n.length+8*a.length)).set(n),r=n.length,l=0;l<a.length;l++)o=a[l],s[r++]=(4278190080&o.duration)>>>24,s[r++]=(16711680&o.duration)>>>16,s[r++]=(65280&o.duration)>>>8,s[r++]=255&o.duration,s[r++]=(4278190080&o.size)>>>24,s[r++]=(16711680&o.size)>>>16,s[r++]=(65280&o.size)>>>8,s[r++]=255&o.size;return i(E.trun,s)},S=function(e,t){return"audio"===e.type?F(e,t):j(e,t)};var G,z,X,K,Y,Q,J,Z,ee={ftyp:n=function(){return i(E.ftyp,w,k,w,C)},mdat:function(e){return i(E.mdat,e)},moof:l,moov:u,initSegment:function(e){var t,i=n(),s=u(e);return(t=new Uint8Array(i.byteLength+s.byteLength)).set(i),t.set(s,i.byteLength),t}},te=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ie=function(e,t){var i=te();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},se={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,s.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(s.length&&(s.duration=i.dts-s.dts,r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s)),(s=[i]).byteLength=i.data.byteLength,s.pts=i.pts,s.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(s.keyFrame=!0),s.duration=i.dts-s.dts,s.byteLength+=i.data.byteLength,s.push(i));return r.length&&(!s.duration||s.duration<=0)&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s),r},groupFramesIntoGops:function(e){var t,i,s=[],r=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,s.pts=e[0].pts,s.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(s.length&&(r.push(s),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration),(s=[i]).nalCount=i.length,s.byteLength=i.byteLength,s.pts=i.pts,s.dts=i.dts,s.duration=i.duration):(s.duration+=i.duration,s.nalCount+=i.length,s.byteLength+=i.byteLength,s.push(i));return r.length&&s.duration<=0&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration,r.push(s),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,s,r,n,a,o=t||0,l=[];for(i=0;i<e.length;i++)for(n=e[i],s=0;s<n.length;s++)a=n[s],o+=(r=ie(a,o)).size,l.push(r);return l},concatenateNalData:function(e){var t,i,s,r,n,a,o=0,l=e.byteLength,u=e.nalCount,d=new Uint8Array(l+4*u),h=new DataView(d.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(n=r[i],s=0;s<n.length;s++)a=n[s],h.setUint32(o,a.data.byteLength),o+=4,d.set(a.data,o),o+=a.data.byteLength;return d},generateSampleTableForFrame:function(e,t){var i,s=[];return i=ie(e,t||0),s.push(i),s},concatenateNalDataForFrame:function(e){var t,i,s=0,r=e.byteLength,n=e.length,a=new Uint8Array(r+4*n),o=new DataView(a.buffer);for(t=0;t<e.length;t++)i=e[t],o.setUint32(s,i.data.byteLength),s+=4,a.set(i.data,s),s+=i.data.byteLength;return a}},re=[33,16,5,32,164,27],ne=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ae=function(e){for(var t=[];e--;)t.push(0);return t},oe=function(e){return Object.keys(e).reduce((function(t,i){return t[i]=new Uint8Array(e[i].reduce((function(e,t){return e.concat(t)}),[])),t}),{})},le=function(){if(!G){var e={96e3:[re,[227,64],ae(154),[56]],88200:[re,[231],ae(170),[56]],64e3:[re,[248,192],ae(240),[56]],48e3:[re,[255,192],ae(268),[55,148,128],ae(54),[112]],44100:[re,[255,192],ae(268),[55,163,128],ae(84),[112]],32e3:[re,[255,192],ae(268),[55,234],ae(226),[112]],24e3:[re,[255,192],ae(268),[55,255,128],ae(268),[111,112],ae(126),[224]],16e3:[re,[255,192],ae(268),[55,255,128],ae(268),[111,255],ae(269),[223,108],ae(195),[1,192]],12e3:[ne,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,253,128],ae(259),[56]],11025:[ne,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,255,192],ae(268),[55,175,128],ae(108),[112]],8e3:[ne,ae(268),[3,121,16],ae(47),[7]]};G=oe(e)}return G},ue=9e4;Q=function(e,t){return z(Y(e,t))},J=function(e,t){return X(K(e),t)},Z=function(e,t,i){return K(i?e:e-t)};var de={ONE_SECOND_IN_TS:ue,secondsToVideoTs:z=function(e){return e*ue},secondsToAudioTs:X=function(e,t){return e*t},videoTsToSeconds:K=function(e){return e/ue},audioTsToSeconds:Y=function(e,t){return e/t},audioTsToVideoTs:Q,videoTsToAudioTs:J,metadataTsToSeconds:Z},he=le,ce=de,pe=function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i},me={prefixWithSilence:function(e,t,i,s){var r,n,a,o,l=0,u=0,d=0,h=0;if(t.length&&(r=ce.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),l=Math.ceil(ce.ONE_SECOND_IN_TS/(e.samplerate/1024)),i&&s&&(u=r-Math.max(i,s),h=(d=Math.floor(u/l))*l),!(d<1||h>ce.ONE_SECOND_IN_TS/2))){for((n=he()[e.samplerate])||(n=t[0].data),a=0;a<d;a++)o=t[0],t.splice(0,0,{data:n,dts:o.dts-l,pts:o.pts-l});return e.baseMediaDecodeTime-=Math.floor(ce.videoTsToAudioTs(h,e.samplerate)),h}},trimAdtsFramesByEarliestDts:function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},generateSampleTable:function(e){var t,i,s=[];for(t=0;t<e.length;t++)i=e[t],s.push({size:i.data.byteLength,duration:1024});return s},concatenateFrameData:function(e){var t,i,s=0,r=new Uint8Array(pe(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,s),s+=i.data.byteLength;return r}},ge=de.ONE_SECOND_IN_TS,fe={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var i,s=e.minSegmentDts;return t||(s-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=s,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/ge,i=Math.floor(i)),i},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},ye=4,_e=128,be={parseSei:function(e){for(var t=0,i={payloadType:-1,payloadSize:0},s=0,r=0;t<e.byteLength&&e[t]!==_e;){for(;255===e[t];)s+=255,t++;for(s+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&s===ye){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=s,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,s=0,r=0}return i},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var i,s,r,n,a=[];if(!(64&t[0]))return a;for(s=31&t[0],i=0;i<s;i++)n={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(n.ccData=t[r+3]<<8|t[r+4],a.push(n));return a},discardEmulationPreventionBytes:function(e){for(var t,i,s=e.byteLength,r=[],n=1;n<s-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;t=s-r.length,i=new Uint8Array(t);var a=0;for(n=0;n<t;a++,n++)a===r[0]&&(a++,r.shift()),i[n]=e[a];return i},USER_DATA_REGISTERED_ITU_T_T35:ye},ve=$,Te=be,Se=function(e){e=e||{},Se.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Ne(0,0),new Ne(0,1),new Ne(1,0),new Ne(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ie({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Se.prototype=new ve,Se.prototype.push=function(e){var t,i,s;if("sei_rbsp"===e.nalUnitType&&(t=Te.parseSei(e.escapedRBSP)).payload&&t.payloadType===Te.USER_DATA_REGISTERED_ITU_T_T35&&(i=Te.parseUserData(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));s=Te.parseCaptionPackets(e.pts,i),this.captionPackets_=this.captionPackets_.concat(s),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Se.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Se.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Se.prototype.flush=function(){return this.flushStream("flush")},Se.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Se.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Se.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Se.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Se.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Se.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Se.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Ee={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},we=function(e){var t=Ee[e]||e;return 4096&e&&e===t?"":String.fromCharCode(t)},ke=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Ce=function(e){this.windowNum=e,this.reset()};Ce.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Ce.prototype.getText=function(){return this.rows.join("\n")},Ce.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ce.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Ce.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Ce.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Ce.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var xe=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Ce(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};xe.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Ce(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},xe.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},xe.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ie=function(e){e=e||{},Ie.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach((e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(i.new708Packet(),i.add708Bytes(e)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e))}};Ie.prototype=new ve,Ie.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ie.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,s=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},Ie.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,s=null,r=0,n=t[r++];for(e.seq=n>>6,e.sizeCode=63&n;r<t.length;r++)s=31&(n=t[r++]),7===(i=n>>5)&&s>0&&(i=n=t[r++]),this.pushServiceBlock(i,r,s),s>0&&(r+=s-1)},Ie.prototype.pushServiceBlock=function(e,t,i){var s,r=t,n=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,r));r<t+i&&r<n.length;r++)s=n[r],ke(s)?r=this.handleText(r,a):24===s?r=this.multiByteCharacter(r,a):16===s?r=this.extendedCommands(r,a):128<=s&&s<=135?r=this.setCurrentWindow(r,a):152<=s&&s<=159?r=this.defineWindow(r,a):136===s?r=this.clearWindows(r,a):140===s?r=this.deleteWindows(r,a):137===s?r=this.displayWindows(r,a):138===s?r=this.hideWindows(r,a):139===s?r=this.toggleWindows(r,a):151===s?r=this.setWindowAttributes(r,a):144===s?r=this.setPenAttributes(r,a):145===s?r=this.setPenColor(r,a):146===s?r=this.setPenLocation(r,a):143===s?a=this.reset(r,a):8===s?a.currentWindow.backspace():12===s?a.currentWindow.clearText():13===s?a.currentWindow.pendingNewLine=!0:14===s?a.currentWindow.clearText():141===s&&r++},Ie.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return ke(i)&&(e=this.handleText(e,t,{isExtended:!0})),e},Ie.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ie.prototype.initService=function(e,t){var i,s,r=this;return(i="SERVICE"+e)in this.serviceEncodings&&(s=this.serviceEncodings[i]),this.services[e]=new xe(e,s,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},Ie.prototype.handleText=function(e,t,i){var s,r,n=i&&i.isExtended,a=i&&i.isMultiByte,o=this.current708Packet.data,l=n?4096:0,u=o[e],d=o[e+1],h=t.currentWindow;return t.textDecoder_&&!n?(a?(r=[u,d],e++):r=[u],s=t.textDecoder_.decode(new Uint8Array(r))):s=we(l|u),h.pendingNewLine&&!h.isEmpty()&&h.newLine(this.getPts(e)),h.pendingNewLine=!1,h.addText(s),e},Ie.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],r=i[e+2];return ke(s)&&ke(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Ie.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Ie.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],r=7&s;t.setCurrentWindow(r);var n=t.currentWindow;return s=i[++e],n.visible=(32&s)>>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++e],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++e],n.anchorHorizontal=s,s=i[++e],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++e],n.columnCount=63&s,s=i[++e],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,e},Ie.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.winAttr;return s=i[++e],r.fillOpacity=(192&s)>>6,r.fillRed=(48&s)>>4,r.fillGreen=(12&s)>>2,r.fillBlue=3&s,s=i[++e],r.borderType=(192&s)>>6,r.borderRed=(48&s)>>4,r.borderGreen=(12&s)>>2,r.borderBlue=3&s,s=i[++e],r.borderType+=(128&s)>>5,r.wordWrap=(64&s)>>6,r.printDirection=(48&s)>>4,r.scrollDirection=(12&s)>>2,r.justify=3&s,s=i[++e],r.effectSpeed=(240&s)>>4,r.effectDirection=(12&s)>>2,r.displayEffect=3&s,e},Ie.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Ie.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ie.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Ie.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Ie.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Ie.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Ie.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Ie.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penAttr;return s=i[++e],r.textTag=(240&s)>>4,r.offset=(12&s)>>2,r.penSize=3&s,s=i[++e],r.italics=(128&s)>>7,r.underline=(64&s)>>6,r.edgeType=(56&s)>>3,r.fontStyle=7&s,e},Ie.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penColor;return s=i[++e],r.fgOpacity=(192&s)>>6,r.fgRed=(48&s)>>4,r.fgGreen=(12&s)>>2,r.fgBlue=3&s,s=i[++e],r.bgOpacity=(192&s)>>6,r.bgRed=(48&s)>>4,r.bgGreen=(12&s)>>2,r.bgBlue=3&s,s=i[++e],r.edgeRed=(48&s)>>4,r.edgeGreen=(12&s)>>2,r.edgeBlue=3&s,e},Ie.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,s=i[++e],r.row=15&s,s=i[++e],r.column=63&s,e},Ie.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Ae={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},De=function(e){return null===e?"":(e=Ae[e]||e,String.fromCharCode(e))},Le=14,Pe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oe=function(){for(var e=[],t=Le+1;t--;)e.push("");return e},Ne=function(e,t){Ne.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),s=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Oe();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Oe();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Oe()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(s,r))n=De((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isExtCharacter(s,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),n=De((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isMidRowCode(s,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(s,r))this.column_+=3&r;else if(this.isPAC(s,r)){var a=Pe.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(s)&&(0===r&&(r=null),n=De(s),n+=De(r),this[this.mode_](e.pts,n),this.column_+=n.length)}else this.lastControlCode_=null}};Ne.prototype=new ve,Ne.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(Gf){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ne.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Oe(),this.nonDisplayed_=Oe(),this.lastControlCode_=null,this.column_=0,this.row_=Le,this.rollUpRows_=2,this.formatting_=[]},Ne.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ne.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ne.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ne.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ne.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ne.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Ne.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ne.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ne.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=Le,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Oe(),this.displayed_=Oe()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Ne.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},Ne.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},Ne.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ne.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ne.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<Le+1;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Ne.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Re={CaptionStream:Se,Cea608Stream:Ne,Cea708Stream:Ie},Me={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ue=$,Be=8589934592,Fe=4294967296,je="shared",qe=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>Fe;)e+=i*Be;return e},$e=function(e){var t,i;$e.prototype.init.call(this),this.type_=e||je,this.push=function(e){this.type_!==je&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=qe(e.dts,i),e.pts=qe(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};$e.prototype=new Ue;var Ve,He={TimestampRolloverStream:$e,handleRollover:qe},We=(e,t,i)=>{if(!e)return-1;for(var s=i;s<e.length;s++)if(e[s]===t)return s;return-1},Ge={typedArrayIndexOf:We}.typedArrayIndexOf,ze={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Xe=function(e,t,i){var s,r="";for(s=t;s<i;s++)r+="%"+("00"+e[s].toString(16)).slice(-2);return r},Ke=function(e,t,i){return decodeURIComponent(Xe(e,t,i))},Ye=function(e,t,i){return unescape(Xe(e,t,i))},Qe=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Je={APIC:function(e){var t,i,s=1,r="--\x3e";e.data[0]===ze.Utf8&&((t=Ge(e.data,0,s))<0||(e.mimeType=Ye(e.data,s,t),s=t+1,e.pictureType=e.data[s],s++,(i=Ge(e.data,0,s))<0||(e.description=Ke(e.data,s,i),s=i+1,e.mimeType===r?e.url=Ye(e.data,s,e.data.length):e.pictureData=e.data.subarray(s,e.data.length))))},"T*":function(e){e.data[0]===ze.Utf8&&(e.value=Ke(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===ze.Utf8&&-1!==(t=Ge(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.value=Ke(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=Ye(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===ze.Utf8&&-1!==(t=Ge(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.url=Ye(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=Ye(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},Ze={parseId3Frames:function(e){var t,i=10,s=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){s=Qe(e.subarray(6,10)),s+=10,64&e[5]&&(i+=4,i+=Qe(e.subarray(10,14)),s-=Qe(e.subarray(16,20)));do{if((t=Qe(e.subarray(i+4,i+8)))<1)break;var n={id:String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]),data:e.subarray(i+10,i+t+10)};n.key=n.id,Je[n.id]?Je[n.id](n):"T"===n.id[0]?Je["T*"](n):"W"===n.id[0]&&Je["W*"](n),r.push(n),i+=10,i+=t}while(i<s);return r}},parseSyncSafeInteger:Qe,frameParsers:Je},et=Me,tt=Ze;(Ve=function(e){var t,i={descriptor:e&&e.descriptor},s=0,r=[],n=0;if(Ve.prototype.init.call(this),this.dispatchType=et.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,a,o,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(n=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),n+=e.data.byteLength,1===r.length&&(s=tt.parseSyncSafeInteger(e.data.subarray(6,10)),s+=10),!(n<s)){for(t={data:new Uint8Array(s),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<s;)t.data.set(r[0].data.subarray(0,s-l),l),l+=r[0].data.byteLength,n-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=tt.parseSyncSafeInteger(t.data.subarray(10,14)),s-=tt.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((a=tt.parseSyncSafeInteger(t.data.subarray(i+4,i+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if((o={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+a+10)}).key=o.id,tt.frameParsers[o.id]?tt.frameParsers[o.id](o):"T"===o.id[0]?tt.frameParsers["T*"](o):"W"===o.id[0]&&tt.frameParsers["W*"](o),"com.apple.streaming.transportStreamTimestamp"===o.owner){var u=o.data,d=(1&u[3])<<30|u[4]<<22|u[5]<<14|u[6]<<6|u[7]>>>2;d*=4,d+=3&u[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=a}while(i<s);this.trigger("data",t)}}}).prototype=new $;var it,st,rt,nt=Ve,at=$,ot=Re,lt=Me,ut=He.TimestampRolloverStream,dt=188,ht=71;(it=function(){var e=new Uint8Array(dt),t=0;it.prototype.init.call(this),this.push=function(i){var s,r=0,n=dt;for(t?((s=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),s.set(i,t),t=0):s=i;n<s.byteLength;)s[r]!==ht||s[n]!==ht?(r++,n++):(this.trigger("data",s.subarray(r,n)),r+=dt,n+=dt);r<s.byteLength&&(e.set(s.subarray(r),0),t=s.byteLength-r)},this.flush=function(){t===dt&&e[0]===ht&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new at,st=function(){var e,t,i,s;st.prototype.init.call(this),s=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,s){var r=0;s.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===s.type?t(e.subarray(r),s):i(e.subarray(r),s)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],s.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=s.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var n=e[r],a=(31&e[r+1])<<8|e[r+2];n===lt.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=a:n===lt.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=a:n===lt.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][a]=n),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=s.programMapTable}},this.push=function(t){var i={},s=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(s+=t[s]+1),0===i.pid)i.type="pat",e(t.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,s,i]):this.processPes_(t,s,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=lt.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=lt.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},st.prototype=new at,st.STREAM_TYPES={h264:27,adts:15},rt=function(){var e,t=this,i=!1,s={data:[],size:0},r={data:[],size:0},n={data:[],size:0},a=function(e,t){var i;const s=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===s&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))},o=function(e,i,s){var r,n=new Uint8Array(e.size),o={type:i},l=0,u=0,d=!1;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,l=0;l<e.data.length;l++)r=e.data[l],n.set(r.data,u),u+=r.data.byteLength;a(n,o),d="video"===i||o.packetLength<=e.size,(s||d)&&(e.size=0,e.data.length=0),d&&t.trigger("data",o)}};rt.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,t;switch(a.streamType){case lt.H264_STREAM_TYPE:e=s,t="video";break;case lt.ADTS_STREAM_TYPE:e=r,t="audio";break;case lt.METADATA_STREAM_TYPE:e=n,t="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&o(e,t,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(e=a.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",s)}})[a.type]()},this.reset=function(){s.size=0,s.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){o(s,"video"),o(r,"audio"),o(n,"timed-metadata")},this.flush=function(){if(!i&&e){var s={type:"metadata",tracks:[]};null!==e.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}},rt.prototype=new at;var ct={PAT_PID:0,MP2T_PACKET_LENGTH:dt,TransportPacketStream:it,TransportParseStream:st,ElementaryStream:rt,TimestampRolloverStream:ut,CaptionStream:ot.CaptionStream,Cea608Stream:ot.Cea608Stream,Cea708Stream:ot.Cea708Stream,MetadataStream:nt};for(var pt in lt)lt.hasOwnProperty(pt)&&(ct[pt]=lt[pt]);var mt,gt=ct,ft=$,yt=de.ONE_SECOND_IN_TS,_t=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(mt=function(e){var t,i=0;mt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${i} outside syncword`})},this.push=function(s){var r,n,a,o,l,u=0;if(e||(i=0),"audio"===s.type){var d;for(t&&t.length?(a=t,(t=new Uint8Array(a.byteLength+s.data.byteLength)).set(a),t.set(s.data,a.byteLength)):t=s.data;u+7<t.length;)if(255===t[u]&&240==(246&t[u+1])){if("number"==typeof d&&(this.skipWarn_(d,u),d=null),n=2*(1&~t[u+1]),r=(3&t[u+3])<<11|t[u+4]<<3|(224&t[u+5])>>5,l=(o=1024*(1+(3&t[u+6])))*yt/_t[(60&t[u+2])>>>2],t.byteLength-u<r)break;this.trigger("data",{pts:s.pts+i*l,dts:s.dts+i*l,sampleCount:o,audioobjecttype:1+(t[u+2]>>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:_t[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+n,u+r)}),i++,u+=r}else"number"!=typeof d&&(d=u),u++;"number"==typeof d&&(this.skipWarn_(d,u),d=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new ft;var bt,vt=mt;bt=function(e){var t=e.byteLength,i=0,s=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+s},this.loadWord=function(){var r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");n.set(e.subarray(r,r+a)),i=new DataView(n.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var r;s>e?(i<<=e,s-=e):(e-=s,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,s-=e)},this.readBits=function(e){var r=Math.min(s,e),n=i>>>32-r;return(s-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?n<<r|this.readBits(r):n},this.skipLeadingZeros=function(){var e;for(e=0;e<s;++e)if(0!=(i&2147483648>>>e))return i<<=e,s-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Tt,St,Et,wt=$,kt=bt;(St=function(){var e,t,i=0;St.prototype.init.call(this),this.push=function(s){var r;t?((r=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),r.set(s.data,t.byteLength),t=r):t=s.data;for(var n=t.byteLength;i<n-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<n;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<n);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new wt,Et={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Tt=function(){var e,t,i,s,r,n,a,o=new St;Tt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,o.push(e))},o.on("data",(function(a){var o={trackId:t,pts:i,dts:s,data:a,nalUnitTypeCode:31&a[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,s=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(s+t.readExpGolomb()+256)%256),s=0===r?s:r},r=function(e){for(var t,i,s=e.byteLength,r=[],n=1;n<s-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;t=s-r.length,i=new Uint8Array(t);var a=0;for(n=0;n<t;a++,n++)a===r[0]&&(a++,r.shift()),i[n]=e[a];return i},n=function(e){var t,i,s,r,n,o,l,u,d,h,c,p,m=0,g=0,f=0,y=0,_=[1,1];if(i=(t=new kt(e)).readUnsignedByte(),r=t.readUnsignedByte(),s=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Et[i]&&(3===(n=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(c=3!==n?8:12,p=0;p<c;p++)t.readBoolean()&&a(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),l=t.readUnsignedExpGolomb(),p=0;p<l;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),u=t.readUnsignedExpGolomb(),d=t.readUnsignedExpGolomb(),0===(h=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),f=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}_&&(_[0],_[1])}return{profileIdc:i,levelIdc:s,profileCompatibility:r,width:16*(u+1)-2*m-2*g,height:(2-h)*(d+1)*16-2*f-2*y,sarRatio:_}}},Tt.prototype=new wt;var Ct,xt={H264Stream:Tt,NalByteStream:St},It=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],At=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=i>=0?i:0,(16&e[t+5])>>4?i+20:i+10},Dt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=At(e,t),Dt(e,t))},Lt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Pt=function(e,t,i){var s,r="";for(s=t;s<i;s++)r+="%"+("00"+e[s].toString(16)).slice(-2);return r},Ot=function(e,t,i){return unescape(Pt(e,t,i))},Nt={isLikelyAacData:function(e){var t=Dt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:At,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return It[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,s;t=10,64&e[5]&&(t+=4,t+=Lt(e.subarray(10,14)));do{if((i=Lt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){s=e.subarray(t+10,t+i+10);for(var r=0;r<s.byteLength;r++)if(0===s[r]){if("com.apple.streaming.transportStreamTimestamp"===Ot(s,0,r)){var n=s.subarray(r+1),a=(1&n[3])<<30|n[4]<<22|n[5]<<14|n[6]<<6|n[7]>>>2;return a*=4,a+=3&n[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}},Rt=Nt;(Ct=function(){var e=new Uint8Array,t=0;Ct.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var s,r,n,a,o=0,l=0;for(e.length?(a=e.length,(e=new Uint8Array(i.byteLength+a)).set(e.subarray(0,a)),e.set(i,a)):e=i;e.length-l>=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=Rt.parseAdtsSize(e,l))>e.length)break;n={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",n),l+=o}else{if(e.length-l<10)break;if(l+(o=Rt.parseId3TagSize(e,l))>e.length)break;r={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",r),l+=o}s=e.length-l,e=s>0?e.subarray(l):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new $;var Mt,Ut,Bt,Ft,jt=Ct,qt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],$t=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Vt=$,Ht=ee,Wt=se,Gt=me,zt=fe,Xt=gt,Kt=de,Yt=vt,Qt=xt.H264Stream,Jt=jt,Zt=Nt.isLikelyAacData,ei=de.ONE_SECOND_IN_TS,ti=qt,ii=$t,si=function(e,t){t.stream=e,this.trigger("log",t)},ri=function(e,t){for(var i=Object.keys(t),s=0;s<i.length;s++){var r=i[s];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",si.bind(e,r))}},ni=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},ai=function(e,t,i,s,r,n){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(s-t),pts:e+(r-i)},prependedContentDuration:n,baseMediaDecodeTime:e}};Ut=function(e,t){var i,s=[],r=0,n=0,a=1/0;i=(t=t||{}).firstSequenceNumber||0,Ut.prototype.init.call(this),this.push=function(t){zt.collectDtsInfo(e,t),e&&ti.forEach((function(i){e[i]=t[i]})),s.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){a=e},this.setAudioAppendStart=function(e){n=e},this.flush=function(){var o,l,u,d,h,c,p;0!==s.length?(o=Gt.trimAdtsFramesByEarliestDts(s,e,r),e.baseMediaDecodeTime=zt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=Gt.prefixWithSilence(e,o,n,a),e.samples=Gt.generateSampleTable(o),u=Ht.mdat(Gt.concatenateFrameData(o)),s=[],l=Ht.moof(i,[e]),d=new Uint8Array(l.byteLength+u.byteLength),i++,d.set(l),d.set(u,l.byteLength),zt.clearDtsInfo(e),h=Math.ceil(1024*ei/e.samplerate),o.length&&(c=o.length*h,this.trigger("segmentTimingInfo",ai(Kt.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:d}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){zt.clearDtsInfo(e),s=[],this.trigger("reset")}},Ut.prototype=new Vt,Mt=function(e,t){var i,s,r,n=[],a=[];i=(t=t||{}).firstSequenceNumber||0,Mt.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){zt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.config,e.sps=[t.data],ii.forEach((function(t){e[t]=s[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),n.push(t)},this.flush=function(){for(var s,r,o,l,u,d,h,c,p=0;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(s=Wt.groupNalsIntoFrames(n),(o=Wt.groupFramesIntoGops(s))[0][0].keyFrame||((r=this.getGopForFusion_(n[0],e))?(p=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=Wt.extendFirstKeyFrame(o)),a.length){var m;if(!(m=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");zt.clearDtsInfo(e),o=m}zt.collectDtsInfo(e,o),e.samples=Wt.generateSampleTable(o),u=Ht.mdat(Wt.concatenateNalData(o)),e.baseMediaDecodeTime=zt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),h=o[0],c=o[o.length-1],this.trigger("segmentTimingInfo",ai(e.baseMediaDecodeTime,h.dts,h.pts,c.dts+c.duration,c.pts+c.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),l=Ht.moof(i,[e]),d=new Uint8Array(l.byteLength+u.byteLength),i++,d.set(l),d.set(u,l.byteLength),this.trigger("data",{track:e,boxes:d}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),n=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){zt.clearDtsInfo(e),s=void 0,r=void 0},this.getGopForFusion_=function(t){var i,s,r,n,a,o=45e3,l=1e4,u=1/0;for(a=0;a<this.gopCache_.length;a++)r=(n=this.gopCache_[a]).gop,e.pps&&ni(e.pps[0],n.pps[0])&&e.sps&&ni(e.sps[0],n.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-l&&i<=o&&(!s||u>i)&&(s=n,u=i));return s?s.gop:null},this.alignGopsAtStart_=function(e){var t,i,s,r,n,o,l,u;for(n=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;t<a.length&&i<e.length&&(s=a[t],r=e[i],s.pts!==r.pts);)r.pts>s.pts?t++:(i++,n-=r.byteLength,o-=r.nalCount,l-=r.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=n,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,s,r,n,o,l;for(t=a.length-1,i=e.length-1,n=null,o=!1;t>=0&&i>=0;){if(s=a[t],r=e[i],s.pts===r.pts){o=!0;break}s.pts>r.pts?t--:(t===a.length-1&&(n=i),i--)}if(!o&&null===n)return null;if(0===(l=o?i:n))return e;var u=e.slice(l),d=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=d.byteLength,u.duration=d.duration,u.nalCount=d.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){a=e}},Mt.prototype=new Vt,Ft=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ft.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},Ft.prototype=new Vt,Ft.prototype.flush=function(e){var t,i,s,r,n=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,ii.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ti.forEach((function(e){a.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,s=Ht.initSegment(this.pendingTracks),a.initSegment=new Uint8Array(s.byteLength),a.initSegment.set(s),a.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)a.data.set(this.pendingBoxes[r],n),n+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=Kt.metadataTsToSeconds(t.startPts,o,this.keepOriginalTimestamps),t.endTime=Kt.metadataTsToSeconds(t.endPts,o,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=Kt.metadataTsToSeconds(i.pts,o,this.keepOriginalTimestamps),a.metadata.push(i);for(a.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",a),r=0;r<a.captions.length;r++)t=a.captions[r],this.trigger("caption",t);for(r=0;r<a.metadata.length;r++)i=a.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ft.prototype.setRemux=function(e){this.remuxTracks=e},(Bt=function(e){var t,i,s=this,r=!0;Bt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Xt.MetadataStream,r.aacStream=new Jt,r.audioTimestampRolloverStream=new Xt.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Xt.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Yt,r.coalesceStream=new Ft(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(n){"timed-metadata"!==n.type&&"audio"!==n.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Ut(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ri(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Xt.MetadataStream,r.packetStream=new Xt.TransportPacketStream,r.parseStream=new Xt.TransportParseStream,r.elementaryStream=new Xt.ElementaryStream,r.timestampRolloverStream=new Xt.TimestampRolloverStream,r.adtsStream=new Yt,r.h264Stream=new Qt,r.captionStream=new Xt.CaptionStream(e),r.coalesceStream=new Ft(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(n){var a;if("metadata"===n.type){for(a=n.tracks.length;a--;)t||"video"!==n.tracks[a].type?i||"audio"!==n.tracks[a].type||((i=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new Mt(t,e),r.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Ut(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,s.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ri(this,r)},this.setBaseMediaDecodeTime=function(s){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,zt.clearDtsInfo(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,zt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=Zt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Vt;var oi,li,ui,di,hi,ci,pi,mi={Transmuxer:Bt,VideoSegmentStream:Mt,AudioSegmentStream:Ut,AUDIO_PROPERTIES:ti,VIDEO_PROPERTIES:ii,generateSegmentTimingInfo:ai},gi={toUnsigned:function(e){return e>>>0},toHexString:function(e){return("00"+e.toString(16)).slice(-2)}},fi=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},yi=gi.toUnsigned,_i=fi,bi=function(e,t){var i,s,r,n,a,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)s=yi(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=_i(e.subarray(i+4,i+8)),n=s>1?i+s:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,n)):(a=bi(e.subarray(i+8,n),t.slice(1))).length&&(o=o.concat(a))),i=n;return o},vi=bi,Ti=gi.toUnsigned,Si=H.getUint64,Ei=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Si(e.subarray(4)):t.baseMediaDecodeTime=Ti(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},wi=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ki=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],d=s.getUint32(4),h=8;for(r&&(i.dataOffset=s.getInt32(h),h+=4),n&&d&&(t={flags:wi(e.subarray(h,h+4))},h+=4,a&&(t.duration=s.getUint32(h),h+=4),o&&(t.size=s.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=s.getInt32(h):t.compositionTimeOffset=s.getUint32(h),h+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=s.getUint32(h),h+=4),o&&(t.size=s.getUint32(h),h+=4),l&&(t.flags=wi(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=s.getInt32(h):t.compositionTimeOffset=s.getUint32(h),h+=4),i.samples.push(t);return i},Ci=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&s.flags[2],n=2&s.flags[2],a=8&s.flags[2],o=16&s.flags[2],l=32&s.flags[2],u=65536&s.flags[0],d=131072&s.flags[0];return t=8,r&&(t+=4,s.baseDataOffset=i.getUint32(12),t+=4),n&&(s.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(s.defaultSampleDuration=i.getUint32(t),t+=4),o&&(s.defaultSampleSize=i.getUint32(t),t+=4),l&&(s.defaultSampleFlags=i.getUint32(t)),u&&(s.durationIsEmpty=!0),!r&&d&&(s.baseDataOffsetIsMoof=!0),s},xi="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Ii=be.discardEmulationPreventionBytes,Ai=Re.CaptionStream,Di=vi,Li=Ei,Pi=ki,Oi=Ci,Ni=xi,Ri=function(e,t){for(var i=e,s=0;s<t.length;s++){var r=t[s];if(i<r.size)return r;i-=r.size}return null},Mi=function(e,t,i){var s,r,n,a,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=n)if(n=o.getUint32(r),r+=4,!(n<=0))switch(31&e[r]){case 6:var u=e.subarray(r+1,r+1+n),d=Ri(r,t);if(s={nalUnitType:"sei_rbsp",size:n,data:u,escapedRBSP:Ii(u),trackId:i},d)s.pts=d.pts,s.dts=d.dts,a=d;else{if(!a){l.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}s.pts=a.pts,s.dts=a.dts}l.seiNals.push(s)}return l},Ui=function(e,t,i){var s=t,r=i.defaultSampleDuration||0,n=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach((function(e){var t=Pi(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=n),e.trackId=a,e.dts=s,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof s?(e.pts=s+Ni.BigInt(e.compositionTimeOffset),s+=Ni.BigInt(e.duration)):(e.pts=s+e.compositionTimeOffset,s+=e.duration)})),o=o.concat(t)})),o},Bi=function(e,t){var i=Di(e,["moof","traf"]),s=Di(e,["mdat"]),r={},n=[];return s.forEach((function(e,t){var s=i[t];n.push({mdat:e,traf:s})})),n.forEach((function(e){var i,s,n=e.mdat,a=e.traf,o=Di(a,["tfhd"]),l=Oi(o[0]),u=l.trackId,d=Di(a,["tfdt"]),h=d.length>0?Li(d[0]).baseMediaDecodeTime:0,c=Di(a,["trun"]);t===u&&c.length>0&&(i=Ui(c,h,l),s=Mi(n,i,u),r[u]||(r[u]={seiNals:[],logs:[]}),r[u].seiNals=r[u].seiNals.concat(s.seiNals),r[u].logs=r[u].logs.concat(s.logs))})),r},Fi=function(e,t,i){if(null===t)return null;var s=Bi(e,t)[t]||{};return{seiNals:s.seiNals,logs:s.logs,timescale:i}},ji=function(){var e,t,i,s,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new Ai,a=!0,n=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/s,e.endTime=e.endPts/s,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(i!==e[0]||s!==t[i])},this.parse=function(e,n,a){var o;if(!this.isInitialized())return null;if(!n||!a)return null;if(this.isNewInit(n,a))i=n[0],s=a[i];else if(null===i||!s)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,n,a)}return(o=Fi(e,i,s))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;n?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,s=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},qi=ji,$i={uint8ToCString:function(e){for(var t=0,i=String.fromCharCode(e[t]),s="";"\0"!==i;)s+=i,t++,i=String.fromCharCode(e[t]);return s+=i}}.uint8ToCString,Vi=H.getUint64,Hi=function(e){var t,i,s,r,n,a,o,l=4,u=e[0];if(0===u)l+=(t=$i(e.subarray(l))).length,l+=(i=$i(e.subarray(l))).length,s=(d=new DataView(e.buffer)).getUint32(l),l+=4,n=d.getUint32(l),l+=4,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4;else if(1===u){var d;s=(d=new DataView(e.buffer)).getUint32(l),l+=4,r=Vi(e.subarray(l)),l+=8,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4,l+=(t=$i(e.subarray(l))).length,l+=(i=$i(e.subarray(l))).length}var h={scheme_id_uri:t,value:i,timescale:s||1,presentation_time:r,presentation_time_delta:n,event_duration:a,id:o,message_data:new Uint8Array(e.subarray(l,e.byteLength))};return Gi(u,h)?h:void 0},Wi=function(e,t,i,s){return e||0===e?e/t:s+i/t},Gi=function(e,t){var i="\0"!==t.scheme_id_uri,s=0===e&&zi(t.presentation_time_delta)&&i,r=1===e&&zi(t.presentation_time)&&i;return!(e>1)&&s||r},zi=function(e){return void 0!==e||null!==e},Xi={parseEmsgBox:Hi,scaleTime:Wi},Ki=gi.toUnsigned,Yi=gi.toHexString,Qi=vi,Ji=fi,Zi=Xi,es=Ci,ts=ki,is=Ei,ss=H.getUint64,rs=xi,ns=Ze.parseId3Frames;oi=function(e){var t={};return Qi(e,["moov","trak"]).reduce((function(e,t){var i,s,r,n,a;return(i=Qi(t,["tkhd"])[0])?(s=i[0],n=Ki(i[r=0===s?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(a=Qi(t,["mdia","mdhd"])[0])?(r=0===(s=a[0])?12:20,e[n]=Ki(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]),e):null):null}),t)},li=function(e,t){var i=Qi(t,["moof","traf"]).reduce((function(t,i){var s,r=Qi(i,["tfhd"])[0],n=Ki(r[4]<<24|r[5]<<16|r[6]<<8|r[7]),a=e[n]||9e4,o=Qi(i,["tfdt"])[0],l=new DataView(o.buffer,o.byteOffset,o.byteLength);let u;return"bigint"==typeof(s=1===o[0]?ss(o.subarray(4,12)):l.getUint32(4))?u=s/rs.BigInt(a):"number"!=typeof s||isNaN(s)||(u=s/a),u<Number.MAX_SAFE_INTEGER&&(u=Number(u)),u<t&&(t=u),t}),1/0);return"bigint"==typeof i||isFinite(i)?i:0},ui=function(e,t){var i,s=Qi(t,["moof","traf"]),r=0,n=0;if(s&&s.length){var a=Qi(s[0],["tfhd"])[0],o=Qi(s[0],["trun"])[0],l=Qi(s[0],["tfdt"])[0];if(a)i=es(a).trackId;if(l)r=is(l).baseMediaDecodeTime;if(o){var u=ts(o);u.samples&&u.samples.length&&(n=u.samples[0].compositionTimeOffset||0)}}var d=e[i]||9e4;"bigint"==typeof r&&(n=rs.BigInt(n),d=rs.BigInt(d));var h=(r+n)/d;return"bigint"==typeof h&&h<Number.MAX_SAFE_INTEGER&&(h=Number(h)),h},di=function(e){var t=Qi(e,["moov","trak"]),i=[];return t.forEach((function(e){var t=Qi(e,["mdia","hdlr"]),s=Qi(e,["tkhd"]);t.forEach((function(e,t){var r,n,a=Ji(e.subarray(8,12)),o=s[t];"vide"===a&&(n=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),i.push(n))}))})),i},ci=function(e){var t=0===e[0]?12:20;return Ki(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},hi=function(e){var t=Qi(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,s,r={},n=Qi(e,["tkhd"])[0];n&&(s=(t=new DataView(n.buffer,n.byteOffset,n.byteLength)).getUint8(0),r.id=0===s?t.getUint32(12):t.getUint32(20));var a=Qi(e,["mdia","hdlr"])[0];if(a){var o=Ji(a.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var l=Qi(e,["mdia","minf","stbl","stsd"])[0];if(l){var u=l.subarray(8);r.codec=Ji(u.subarray(4,8));var d,h=Qi(u,[r.codec])[0];h&&(/^[asm]vc[1-9]$/i.test(r.codec)?(d=h.subarray(78),"avcC"===Ji(d.subarray(4,8))&&d.length>11?(r.codec+=".",r.codec+=Yi(d[9]),r.codec+=Yi(d[10]),r.codec+=Yi(d[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(d=h.subarray(28),"esds"===Ji(d.subarray(4,8))&&d.length>20&&0!==d[19]?(r.codec+="."+Yi(d[19]),r.codec+="."+Yi(d[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var c=Qi(e,["mdia","mdhd"])[0];c&&(r.timescale=ci(c)),i.push(r)})),i},pi=function(e,t=0){return Qi(e,["emsg"]).map((e=>{var i=Zi.parseEmsgBox(new Uint8Array(e)),s=ns(i.message_data);return{cueTime:Zi.scaleTime(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:Zi.scaleTime(i.event_duration,i.timescale),frames:s}}))};var as={findBox:Qi,parseType:Ji,timescale:oi,startTime:li,compositionStartTime:ui,videoTrackIds:di,tracks:hi,getTimescaleFromMediaHeader:ci,getEmsgID3:pi},os=Me,ls=function(e){var t=31&e[1];return t<<=8,t|=e[2]},us=function(e){return!!(64&e[1])},ds=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},hs=function(e){if(!us(e))return null;var t=4+ds(e);if(t>=e.byteLength)return null;var i,s=null;return 192&(i=e[t+7])&&((s={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,s.pts*=4,s.pts+=(6&e[t+13])>>>1,s.dts=s.pts,64&i&&(s.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,s.dts*=4,s.dts+=(6&e[t+18])>>>1)),s},cs=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},ps={parseType:function(e,t){var i=ls(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=us(e),i=4+ds(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=us(e),s=4+ds(e);if(i&&(s+=e[s]+1),1&e[s+5]){var r;r=3+((15&e[s+1])<<8|e[s+2])-4;for(var n=12+((15&e[s+10])<<8|e[s+11]);n<r;){var a=s+n;t[(31&e[a+1])<<8|e[a+2]]=e[a],n+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:us,parsePesType:function(e,t){switch(t[ls(e)]){case os.H264_STREAM_TYPE:return"video";case os.ADTS_STREAM_TYPE:return"audio";case os.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:hs,videoPacketContainsKeyFrame:function(e){for(var t=4+ds(e),i=e.subarray(t),s=0,r=0,n=!1;r<i.byteLength-3;r++)if(1===i[r+2]){s=r+5;break}for(;s<i.byteLength;)switch(i[s]){case 0:if(0!==i[s-1]){s+=2;break}if(0!==i[s-2]){s++;break}r+3!==s-2&&"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0);do{s++}while(1!==i[s]&&s<i.length);r=s-2,s+=3;break;case 1:if(0!==i[s-1]||0!==i[s-2]){s+=3;break}"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0),r=s-2,s+=3;break;default:s+=3}return i=i.subarray(r),s-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===cs(31&i[r+3])&&(n=!0),n}},ms=Me,gs=He.handleRollover,fs={};fs.ts=ps,fs.aac=Nt;var ys=de.ONE_SECOND_IN_TS,_s=188,bs=71,vs=function(e,t){for(var i,s=0,r=_s;r<e.byteLength;)if(e[s]!==bs||e[r]!==bs)s++,r++;else{switch(i=e.subarray(s,r),fs.ts.parseType(i,t.pid)){case"pat":t.pid=fs.ts.parsePat(i);break;case"pmt":var n=fs.ts.parsePmt(i);t.table=t.table||{},Object.keys(n).forEach((function(e){t.table[e]=n[e]}))}s+=_s,r+=_s}},Ts=function(e,t,i){for(var s,r,n,a,o=0,l=_s,u=!1;l<=e.byteLength;)if(e[o]!==bs||e[l]!==bs&&l!==e.byteLength)o++,l++;else{if(s=e.subarray(o,l),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"audio"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),u=!0);if(u)break;o+=_s,l+=_s}for(o=(l=e.byteLength)-_s,u=!1;o>=0;)if(e[o]!==bs||e[l]!==bs&&l!==e.byteLength)o--,l--;else{if(s=e.subarray(o,l),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"audio"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),u=!0);if(u)break;o-=_s,l-=_s}},Ss=function(e,t,i){for(var s,r,n,a,o,l,u,d=0,h=_s,c=!1,p={data:[],size:0};h<e.byteLength;)if(e[d]!==bs||e[h]!==bs)d++,h++;else{if(s=e.subarray(d,h),"pes"===fs.ts.parseType(s,t.pid))if(r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"video"===r&&(n&&!c&&(a=fs.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0),!i.firstKeyFrame)){if(n&&0!==p.size){for(o=new Uint8Array(p.size),l=0;p.data.length;)u=p.data.shift(),o.set(u,l),l+=u.byteLength;if(fs.ts.videoPacketContainsKeyFrame(o)){var m=fs.ts.parsePesTime(o);m?(i.firstKeyFrame=m,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(s),p.size+=s.byteLength}if(c&&i.firstKeyFrame)break;d+=_s,h+=_s}for(d=(h=e.byteLength)-_s,c=!1;d>=0;)if(e[d]!==bs||e[h]!==bs)d--,h--;else{if(s=e.subarray(d,h),"pes"===fs.ts.parseType(s,t.pid))r=fs.ts.parsePesType(s,t.table),n=fs.ts.parsePayloadUnitStartIndicator(s),"video"===r&&n&&(a=fs.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0);if(c)break;d-=_s,h-=_s}},Es=function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=gs(e.dts,i),e.pts=gs(e.pts,i),e.dtsTime=e.dts/ys,e.ptsTime=e.pts/ys}))}if(e.video&&e.video.length){var s=t;if((void 0===s||isNaN(s))&&(s=e.video[0].dts),e.video.forEach((function(e){e.dts=gs(e.dts,s),e.pts=gs(e.pts,s),e.dtsTime=e.dts/ys,e.ptsTime=e.pts/ys})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=gs(r.dts,s),r.pts=gs(r.pts,s),r.dtsTime=r.dts/ys,r.ptsTime=r.pts/ys}}},ws=function(e){for(var t,i=!1,s=0,r=null,n=null,a=0,o=0;e.length-o>=3;){switch(fs.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=fs.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=fs.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=fs.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=fs.aac.parseSampleRate(t)),s++,o+=a;break;default:o++}if(i)return null}if(null===r||null===n)return null;var l=ys/r;return{audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*s*l,pts:n+1024*s*l}]}},ks=function(e){var t={pid:null,table:null},i={};for(var s in vs(e,t),t.table){if(t.table.hasOwnProperty(s))switch(t.table[s]){case ms.H264_STREAM_TYPE:i.video=[],Ss(e,t,i),0===i.video.length&&delete i.video;break;case ms.ADTS_STREAM_TYPE:i.audio=[],Ts(e,t,i),0===i.audio.length&&delete i.audio}}return i},Cs={inspect:function(e,t){var i;return(i=fs.aac.isLikelyAacData(e)?ws(e):ks(e))&&(i.audio||i.video)?(Es(i,t),i):null},parseAudioPes_:Ts};const xs=function(e,t){t.on("data",(function(t){const i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};const s=t.data;t.data=s.buffer,e.postMessage({action:"data",segment:t,byteOffset:s.byteOffset,byteLength:s.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){const i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){const i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))};class Is{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new mi.Transmuxer(this.options),xs(this.self,this.transmuxer)}pushMp4Captions(e){this.captionParser||(this.captionParser=new qi,this.captionParser.init());const t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){const i=as.startTime(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:t},[t.buffer])}probeMp4Tracks({data:e}){const t=as.tracks(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){const i="number"!=typeof t||isNaN(t)?void 0:t*de.ONE_SECOND_IN_TS,s=Cs.inspect(e,i);let r=null;s&&(r={hasVideo:s.video&&2===s.video.length||!1,hasAudio:s.audio&&2===s.audio.length||!1},r.hasVideo&&(r.videoStart=s.video[0].ptsTime),r.hasAudio&&(r.audioStart=s.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:r,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){const t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}reset(){this.transmuxer.reset()}setTimestampOffset(e){const t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(de.secondsToVideoTs(t)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(de.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Is(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Is(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));var rm=em(sm);const nm=(e,t,i)=>{const{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:u}=e.data.segment;t.buffer.push({captions:n,captionStreams:a,metadata:o});const d=e.data.segment.boxes||{data:e.data.segment.data},h={type:s,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==u&&(h.videoFramePtsTime=u),i(h)},am=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},om=(e,t)=>{t.gopInfo=e.data.gopInfo},lm=e=>{const{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:u,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=e,_={buffer:[]};let b=y;const v=i=>{t.currentTransmux===e&&("data"===i.data.action&&nm(i,_,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&om(i,_),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(b=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(b||(t.onmessage=null,am({transmuxedData:_,callback:m}),um(t))))};if(t.onmessage=v,s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength){const e=i instanceof ArrayBuffer?i:i.buffer,s=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:e,byteOffset:s,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},um=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():lm(e.currentTransmux))},dm=(e,t)=>{e.postMessage({action:t}),um(e)},hm=(e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void dm(t,e);t.transmuxQueue.push(dm.bind(null,t,e))},cm=e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void lm(e);e.transmuxer.transmuxQueue.push(e)};var pm={reset:e=>{hm("reset",e)},endTimeline:e=>{hm("endTimeline",e)},transmux:cm,createTransmuxer:e=>{const t=new rm;t.currentTransmux=null,t.transmuxQueue=[];const i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t}};const mm=function(e){const t=e.transmuxer,i=e.endAction||e.action,s=e.callback,r=He({},e,{endAction:null,transmuxer:null,callback:null}),n=r=>{r.data.action===i&&(t.removeEventListener("message",n),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),s(r.data))};if(t.addEventListener("message",n),e.data){const i=e.data instanceof ArrayBuffer;r.byteOffset=i?0:e.data.byteOffset,r.byteLength=e.data.byteLength;const s=[i?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},gm={FAILURE:2,TIMEOUT:-101,ABORTED:-102},fm=e=>{e.forEach((e=>{e.abort()}))},ym=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),_m=e=>{const t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},bm=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:gm.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:gm.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:gm.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:gm.FAILURE,xhr:t}:null,vm=(e,t,i)=>(s,r)=>{const n=r.response,a=bm(s,r);if(a)return i(a,e);if(16!==n.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:gm.FAILURE,xhr:r},e);const o=new DataView(n),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let e=0;e<t.length;e++)t[e].bytes=l;return i(null,e)},Tm=(e,t)=>{const i=la(e.map.bytes);if("mp4"!==i){const s=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${s}`,code:gm.FAILURE})}mm({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:s})=>(e.map.bytes=s,i.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null))})},Sm=({segment:e,finishProcessingFn:t})=>(i,s)=>{const r=bm(i,s);if(r)return t(r,e);const n=new Uint8Array(s.response);if(e.map.key)return e.map.encryptedBytes=n,t(null,e);e.map.bytes=n,Tm(e,(function(i){if(i)return i.xhr=s,i.status=s.status,t(i,e);t(null,e)}))},Em=({segment:e,finishProcessingFn:t,responseType:i})=>(s,r)=>{const n=bm(s,r);if(n)return t(n,e);const a="arraybuffer"!==i&&r.responseText?Qp(r.responseText.substring(e.lastReachedChar||0)):r.response;return e.stats=ym(r),e.key?e.encryptedBytes=new Uint8Array(a):e.bytes=new Uint8Array(a),t(null,e)},wm=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{const p=e.map&&e.map.tracks||{},m=Boolean(p.audio&&p.video);let g=s.bind(null,e,"audio","start");const f=s.bind(null,e,"audio","end");let y=s.bind(null,e,"video","start");const _=s.bind(null,e,"video","end"),b=()=>cm({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,d(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{g&&void 0!==e.start&&(g(e.start),g=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}});mm({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data;const r=s.result;r&&(i(e,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:m}),i=null,r.hasAudio&&!m&&g(r.audioStart),r.hasVideo&&y(r.videoStart),g=null,y=null),b()}})},km=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(ua(p)){e.isFmp4=!0;const{tracks:r}=e.map,n={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio};r.audio&&r.audio.codec&&"enca"!==r.audio.codec&&(n.audioCodec=r.audio.codec),r.video&&r.video.codec&&"encv"!==r.video.codec&&(n.videoCodec=r.video.codec),r.video&&r.audio&&(n.isMuxed=!0),i(e,n);const a=t=>{d(e,{data:p,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),t&&t.length&&o(e,t),h(null,e,{})};mm({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:o})=>{t=i.buffer,e.bytes=p=i,n.hasAudio&&!n.isMuxed&&s(e,"audio","start",o),n.hasVideo&&s(e,"video","start",o),r.video&&i.byteLength&&e.transmuxer?mm({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach((function(e){c(cc(e,{stream:"mp4CaptionParser"}))})),a(i.captions)}}):a()}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=la(p)),"ts"!==e.container&&"aac"!==e.container)return i(e,{hasAudio:!1,hasVideo:!1}),void h(null,e,{});wm({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})}else h(null,e,{})},Cm=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s},r){const n=t=>{if(t.data.source===e){s.removeEventListener("message",n);const e=t.data.decrypted;r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let a;s.addEventListener("message",n),a=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(Sp({source:e,encrypted:i,key:a,iv:t.iv}),[i.buffer,a.buffer])},xm=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{Cm({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,km({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})}))},Im=({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(g,f)=>{if(!m){if(g)return m=!0,fm(e),h(g,f);if(p+=1,p===e.length){const p=function(){if(f.encryptedBytes)return xm({decryptionWorker:t,segment:f,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c});km({segment:f,bytes:f.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return Cm({decryptionWorker:t,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},(t=>{f.map.bytes=t,Tm(f,(t=>{if(t)return fm(e),h(t,f);p()}))}));p()}}}},Am=({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)},Dm=({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d})=>i=>{if(!i.target.aborted)return e.stats=cc(e.stats,_m(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)},Lm=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[],_=Im({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f});if(s.key&&!s.key.bytes){const i=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&i.push(s.map.key);const r=e(cc(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),vm(s,i,_));y.push(r)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){const i=e(cc(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),vm(s,[s.map.key],_));y.push(i)}const i=e(cc(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:_p(s.map)}),Sm({segment:s,finishProcessingFn:_}));y.push(i)}const b=cc(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:_p(s)}),v=e(b,Em({segment:s,finishProcessingFn:_,responseType:b.responseType}));v.addEventListener("progress",Dm({segment:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(v);const T={};return y.forEach((e=>{e.addEventListener("loadend",Am({loadendState:T,abortFn:r}))})),()=>fm(y)},Pm=hc("CodecUtils"),Om=function(e){const t=e.attributes||{};if(t.CODECS)return dt(t.CODECS)},Nm=(e,t)=>{const i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Rm=(e,t)=>{if(!Nm(e,t))return!0;const i=t.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(const r in s)if(!s[r].uri&&!s[r].playlists)return!0;return!1},Mm=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push(ut(`${i}${s}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return Pm(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),void(t[e]=null);t[e]=t[e][0]})),t},Um=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},Bm=function(e,t){const i=t.attributes||{},s=Mm(Om(t)||[]);if(Nm(e,t)&&!s.audio&&!Rm(e,t)){const t=Mm(ht(e,i.AUDIO)||[]);t.audio&&(s.audio=t.audio)}return s},Fm=hc("PlaylistSelector"),jm=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},qm=function(e,t){if(!e)return"";const i=g.getComputedStyle(e);return i?i[t]:""},$m=function(e,t){const i=e.slice();e.sort((function(e,s){const r=t(e,s);return 0===r?i.indexOf(e)-i.indexOf(s):r}))},Vm=function(e,t){let i,s;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||g.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(s=t.attributes.BANDWIDTH),s=s||g.Number.MAX_VALUE,i-s},Hm=function(e,t){let i,s;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||g.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),s=s||g.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s};let Wm=function(e,t,i,s,r,n){if(!e)return;const a={bandwidth:t,width:i,height:s,limitRenditionByPlayerDimensions:r};let o=e.playlists;zc.isAudioOnly(e)&&(o=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map((e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,s=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||g.Number.MAX_VALUE,{bandwidth:t,width:i,height:s,playlist:e}}));$m(l,((e,t)=>e.bandwidth-t.bandwidth)),l=l.filter((e=>!zc.isIncompatible(e.playlist)));let u=l.filter((e=>zc.isEnabled(e.playlist)));u.length||(u=l.filter((e=>!zc.isDisabled(e.playlist))));const d=u.filter((e=>e.bandwidth*Yp.BANDWIDTH_VARIANCE<t));let h=d[d.length-1];const c=d.filter((e=>e.bandwidth===h.bandwidth))[0];if(!1===r){const e=c||u[0]||l[0];if(e&&e.playlist){let t="sortedPlaylistReps";return c&&(t="bandwidthBestRep"),u[0]&&(t="enabledPlaylistReps"),Fm(`choosing ${jm(e)} using ${t} with options`,a),e.playlist}return Fm("could not choose a playlist with options",a),null}const p=d.filter((e=>e.width&&e.height));$m(p,((e,t)=>e.width-t.width));const m=p.filter((e=>e.width===i&&e.height===s));h=m[m.length-1];const f=m.filter((e=>e.bandwidth===h.bandwidth))[0];let y,_,b,v;if(f||(y=p.filter((e=>e.width>i||e.height>s)),_=y.filter((e=>e.width===y[0].width&&e.height===y[0].height)),h=_[_.length-1],b=_.filter((e=>e.bandwidth===h.bandwidth))[0]),n.leastPixelDiffSelector){const e=p.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-s),e)));$m(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),v=e[0]}const T=v||b||f||c||u[0]||l[0];if(T&&T.playlist){let e="sortedPlaylistReps";return v?e="leastPixelDiffRep":b?e="resolutionPlusOneRep":f?e="resolutionBestRep":c?e="bandwidthBestRep":u[0]&&(e="enabledPlaylistReps"),Fm(`choosing ${jm(T)} using ${e} with options`,a),T.playlist}return Fm("could not choose a playlist with options",a),null};const Gm=function(){const e=this.useDevicePixelRatio&&g.devicePixelRatio||1;return Wm(this.playlists.main,this.systemBandwidth,parseInt(qm(this.tech_.el(),"width"),10)*e,parseInt(qm(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},zm=function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const s=this.useDevicePixelRatio&&g.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Wm(this.playlists.main,t,parseInt(qm(this.tech_.el(),"width"),10)*s,parseInt(qm(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)}},Xm=function(e){const{main:t,currentTime:i,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e,u=t.playlists.filter((e=>!zc.isIncompatible(e)));let d=u.filter(zc.isEnabled);d.length||(d=u.filter((e=>!zc.isDisabled(e))));const h=d.filter(zc.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:zc.estimateSegmentRequestTime(n,s,e)*t-a}})),c=h.filter((e=>e.rebufferingImpact<=0));return $m(c,((e,t)=>Vm(t.playlist,e.playlist))),c.length?c[0]:($m(h,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),h[0]||null)},Km=function(){const e=this.playlists.main.playlists.filter(zc.isEnabled);$m(e,((e,t)=>Vm(e,t)));return e.filter((e=>!!Bm(this.playlists.main,e).video))[0]||null},Ym=e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,i),i+=e.byteLength}))),t},Qm=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let s=i;/^cc708_/.test(i)&&(s="SERVICE"+i.split("_")[1]);const r=t.textTracks().getTrackById(s);if(r)e[i]=r;else{let r=i,n=i,a=!1;const o=(t.options_.vhs&&t.options_.vhs.captionServices||{})[s];o&&(r=o.label,n=o.language,a=o.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:s,default:a,label:r,language:n},!1).track}}},Jm=function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;const s=g.WebKitDataCue||g.VTTCue;t.forEach((t=>{const r=t.stream;e[r].addCue(new s(t.startTime+i,t.endTime+i,t.text))}))},Zm=function(e){Object.defineProperties(e.frame,{id:{get:()=>(ic.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(ic.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(ic.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})},eg=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(!t)return;const r=g.WebKitDataCue||g.VTTCue,n=e.metadataTrack_;if(!n)return;if(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||g.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((e=>{const i=new r(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,Zm(i),n.addCue(i)}))})),!n.cues||!n.cues.length)return;const a=n.cues,o=[];for(let d=0;d<a.length;d++)a[d]&&o.push(a[d]);const l=o.reduce(((e,t)=>{const i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),u=Object.keys(l).sort(((e,t)=>Number(e)-Number(t)));u.forEach(((e,t)=>{const i=l[e],r=Number(u[t+1])||s;i.forEach((e=>{e.endTime=r}))}))},tg=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)},ig=function(e,t,i){let s,r;if(i&&i.cues)for(s=i.cues.length;s--;)r=i.cues[s],r.startTime>=e&&r.endTime<=t&&i.removeCue(r)},sg=function(e){const t=e.cues;if(t)for(let i=0;i<t.length;i++){const s=[];let r=0;for(let e=0;e<t.length;e++)t[i].startTime===t[e].startTime&&t[i].endTime===t[e].endTime&&t[i].text===t[e].text&&(r++,r>1&&s.push(t[e]));s.length&&s.forEach((t=>e.removeCue(t)))}},rg=(e,t,i)=>{if(null==t||!e.length)return[];const s=Math.ceil((t-i+3)*ha.ONE_SECOND_IN_TS);let r;for(r=0;r<e.length&&!(e[r].pts>s);r++);return e.slice(r)},ng=(e,t,i)=>{if(!t.length)return e;if(i)return t.slice();const s=t[0].pts;let r=0;for(;r<e.length&&!(e[r].pts>=s);r++);return e.slice(0,r).concat(t)},ag=(e,t,i,s)=>{const r=Math.ceil((t-s)*ha.ONE_SECOND_IN_TS),n=Math.ceil((i-s)*ha.ONE_SECOND_IN_TS),a=e.slice();let o=e.length;for(;o--&&!(e[o].pts<=n););if(-1===o)return a;let l=o+1;for(;l--&&!(e[l].pts<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a},og=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;const i=Object.keys(e).sort(),s=Object.keys(t).sort();if(i.length!==s.length)return!1;for(let r=0;r<i.length;r++){const n=i[r];if(n!==s[r])return!1;if(e[n]!==t[n])return!1}return!0},lg=22,ug=function(e,t,i){t=t||[];const s=[];let r=0;for(let n=0;n<t.length;n++){const a=t[n];if(e===a.timeline&&(s.push(n),r+=a.duration,r>i))return n}return 0===s.length?0:s[s.length-1]},dg=1,hg=500,cg=e=>"number"==typeof e&&isFinite(e),pg=1/60,mg=(e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null,gg=(e,t,i)=>{let s=t-Yp.BACK_BUFFER_LENGTH;e.length&&(s=Math.max(s,e.start(0)));const r=t-i;return Math.min(r,s)},fg=e=>{const{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:u,timeline:d}=e,h=o.length-1;let c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);const p="number"==typeof u,m=e.segment.uri?"segment":"pre-segment",g=p?Dc({preloadSegment:s})-1:0;return`${m} [${n+l}/${n+h}]`+(p?` part [${u}/${g}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(p?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},yg=e=>`${e}TimingInfo`,_g=({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r})=>r||e!==t?e<t?i:s.length?s.end(s.length-1):i:null,bg=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{if(t===i)return!1;if("audio"===s){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===s&&r){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},vg=e=>{let t=0;return["video","audio"].forEach((function(i){const s=e[`${i}TimingInfo`];if(!s)return;const{start:r,end:n}=s;let a;"bigint"==typeof r||"bigint"==typeof n?a=g.BigInt(n)-g.BigInt(r):"number"==typeof r&&"number"==typeof n&&(a=n-r),void 0!==a&&a>t&&(t=a)})),"bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),t},Tg=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+mc,Sg=(e,t)=>{if("hls"!==t)return null;const i=vg({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;const s=e.playlist.targetDuration,r=Tg({segmentDuration:i,maxDuration:2*s}),n=Tg({segmentDuration:i,maxDuration:s}),a=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.duration} and the target duration is ${s}. 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 r||n?{severity:r?"warn":"info",message:a}:null};class Eg extends ic.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=ic.browser.IE_VERSION>=11,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_=hc(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return pm.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_&&g.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}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,g.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&pm.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return pc();if("main"===this.loaderType_){const{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ep(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const i=wp(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(s||e).resolvedUri};return s&&(r.bytes=s.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const i=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const n=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${n}]`),null!==this.mediaIndex)if(this.mediaIndex-=n,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}s&&(s.mediaIndex-=n,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&pm.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=(()=>{}),s=!1){if(t===1/0&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let r=1;const n=()=>{r--,0===r&&i()};!s&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,n)),(s||"main"===this.loaderType_)&&(this.gopBuffer_=ag(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,n));for(const a in this.inbandTextTracks_)ig(e,t,this.inbandTextTracks_[a]);ig(e,t,this.segmentMetadataTrack_),n()}monitorBuffer_(){this.checkBufferTimeout_&&g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&g.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.setTimeout(this.monitorBufferTick_.bind(this),hg)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const s="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,n=!s||!s.parts||i+1===s.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&n}chooseNextRequest_(){const e=this.buffered_(),t=kc(e)||0,i=Cc(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||s||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(a.isSyncRequest)a.mediaIndex=ug(this.currentTimeline_,n,t);else if(null!==this.mediaIndex){const e=n[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=i+1):a.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:e,startTime:i,partIndex:s}=zc.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});a.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,a.mediaIndex=e,a.startOfSegment=i,a.partIndex=s}const o=n[a.mediaIndex];let l=o&&"number"==typeof a.partIndex&&o.parts&&o.parts[a.partIndex];if(!o||"number"==typeof a.partIndex&&!l)return null;if("number"!=typeof a.partIndex&&o.parts&&(a.partIndex=0,l=o.parts[0]),!i&&l&&!l.independent)if(0===a.partIndex){const e=n[a.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(a.mediaIndex-=1,a.partIndex=e.parts.length-1,a.independent="previous segment")}else o.parts[a.partIndex-1].independent&&(a.partIndex-=1,a.independent="previous part");const u=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=n.length-1&&u&&!this.seeking_()?null:this.generateSegmentInfo_(a)}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:s,startOfSegment:r,isSyncRequest:n,partIndex:a,forceTimestampOffset:o,getMediaInfoForTime:l}=e,u=i.segments[s],d="number"==typeof a&&u.parts[a],h={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:s,partIndex:d?a:null,isSyncRequest:n,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:c});const p=kc(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=rg(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h}timestampOffsetForSegment_(e){return _g(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,r=zc.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),n=Sc(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=n)return;const a=Xm({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:n,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!a)return;const o=r-n-a.rebufferingImpact;let l=.5;n<=mc&&(l=1),!a.playlist||a.playlist.uri===this.playlist_.uri||o<l||(this.bandwidth=a.playlist.attributes.BANDWIDTH*Yp.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${fg(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}handleTrackInfo_(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},og(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))}handleTimingInfo_(e,t,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const r=this.pendingSegment_,n=yg(t);r[n]=r[n]||{},r[n][i]=s,this.logger_(`timinginfo: ${t} - ${i} - ${s}`),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(0===t.length)return void this.logger_("SegmentLoader received no captions from a caption event");if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));const i=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),s={};t.forEach((e=>{s[e.stream]=s[e.stream]||{startTime:1/0,captions:[],endTime:0};const t=s[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)})),Object.keys(s).forEach((e=>{const{startTime:t,endTime:r,captions:n}=s[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${r} for ${e}`),Qm(a,this.vhs_.tech_,e),ig(t,r,a[e]),Jm({captionArray:n,inbandTextTracks:a,timestampOffset:i})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));const s=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();tg(this.inbandTextTracks_,i,this.vhs_.tech_),eg({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration: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((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:s,isMuxed:r}=t;return!(s&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return void this.callQueue_.push(this.handleData_.bind(this,e,t));const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[yg(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let s;t&&(s=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:s,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});const e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){const e=Ep(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){const r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ec(r).join(", ")),n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ec(n).join(", "));const a=r.length?r.start(0):0,o=r.length?r.end(r.length-1):0,l=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0;if(o-a<=dg&&u-l<=dg)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${Ec(r).join(", ")}, video buffer: ${Ec(n).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const d=this.currentTime_()-dg;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${d}`),this.remove(0,d,(()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${dg}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=g.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3*dg)}),!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(s.code!==lg?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){const e=[s];let t=s.byteLength;i&&(e.unshift(i),t+=i.byteLength),r=Ym({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,r=`${e}TimingInfo`;s[r]||(s[r]={}),s[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[r].transmuxedPresentationStart=i.start.presentation,s[r].transmuxedDecodeStart=i.start.decode,s[r].transmuxedPresentationEnd=i.end.presentation,s[r].transmuxedDecodeEnd=i.end.decode,s[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:s}=t;if(!s||!s.byteLength)return;if("audio"===i&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:s})}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{const t=He({},e,{forceTimestampOffset:!0});He(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}))}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&e.timeline>0,n=i||s&&r;this.logger_(`Requesting ${fg(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Lm({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:n,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:s})=>{this.logger_(`${fg(e)} logged from transmuxer stream ${s} as a ${i}: ${t}`)}})}trimBackBuffer_(e){const t=gg(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,s={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?s.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(s.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){const i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);s.key=this.segmentKey(t.key),s.key.iv=i}return t.map&&(s.map=this.initSegmentForMap(t.map)),s}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<pg?this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${pg}`):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length)return void this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return;if(t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===gm.ABORTED)return;return this.pause(),e.code===gm.TIMEOUT?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),s.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=ng(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){if(void 0!==e)return e;if(!n)return o.start;const l=t.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===s+r?a.start:s}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:i,hasVideo:s,isMuxed:r}=t,n="main"===this.loaderType_&&s,a=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);n&&e.waitingOnAppends++,a&&e.waitingOnAppends++,n&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),a&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=mg(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=Sg(e,this.sourceType_);if(t&&("warn"===t.severity?ic.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_))return void this.logger_(`Throwing away un-appended sync request ${fg(e)}`);this.logger_(`Appended ${fg(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,s=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,n=s&&s.end&&this.currentTime_()-s.end>3*e.playlist.partTargetDuration;if(r||n)return this.logger_(`bad ${r?"segment":"part"} ${fg(e)}`),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<pg)return void this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${pg}`);const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,s=t.end;if(!cg(i)||!cg(s))return;ig(i,s,this.segmentMetadataTrack_);const r=g.WebKitDataCue||g.VTTCue,n={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:s},a=new r(i,s,JSON.stringify(n));a.value=n,this.segmentMetadataTrack_.addCue(a)}}function wg(){}const kg=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Cg=["video","audio"],xg=(e,t)=>{const i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},Ig=(e,t)=>{for(let i=0;i<t.length;i++){const s=t[i];if("mediaSource"===s.type)return null;if(s.type===e)return i}return null},Ag=(e,t)=>{if(0===t.queue.length)return;let i=0,s=t.queue[i];if("mediaSource"!==s.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!xg(e,t)){if(s.type!==e){if(i=Ig(e,t.queue),null===i)return;s=t.queue[i]}return t.queue.splice(i,1),t.queuePending[e]=s,s.action(e,t),s.doneFn?void 0:(t.queuePending[e]=null,void Ag(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),s.action(t),s.doneFn&&s.doneFn(),Ag("audio",t),Ag("video",t))},Dg=(e,t)=>{const i=t[`${e}Buffer`],s=kg(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},Lg=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Pg={appendBuffer:(e,t,i)=>(s,r)=>{const n=r[`${s}Buffer`];if(Lg(r.mediaSource,n)){r.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{n.appendBuffer(e)}catch(Gf){r.logger_(`Error with code ${Gf.code} `+(Gf.code===lg?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${s}Buffer`),r.queuePending[s]=null,i(Gf)}}},remove:(e,t)=>(i,s)=>{const r=s[`${i}Buffer`];if(Lg(s.mediaSource,r)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(Gf){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},timestampOffset:e=>(t,i)=>{const s=i[`${t}Buffer`];Lg(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),s.timestampOffset=e)},callback:e=>(t,i)=>{e()},endOfStream:e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(Gf){ic.log.warn("Failed to call media source endOfStream",Gf)}}},duration:e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(Gf){ic.log.warn("Failed to set media source duration",Gf)}},abort:()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;const i=t[`${e}Buffer`];if(Lg(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(Gf){ic.log.warn(`Failed to abort on ${e}Buffer`,Gf)}}},addSourceBuffer:(e,t)=>i=>{const s=kg(e),r=mt(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const n=i.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",i[`on${s}UpdateEnd_`]),n.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=n},removeSourceBuffer:e=>t=>{const i=t[`${e}Buffer`];if(Dg(e,t),Lg(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(Gf){ic.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,Gf)}}},changeType:e=>(t,i)=>{const s=i[`${t}Buffer`],r=mt(e);Lg(i.mediaSource,s)&&i.codecs[t]!==e&&(i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`),s.changeType(r),i.codecs[t]=e)}},Og=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),Ag(e,t)},Ng=(e,t)=>i=>{if(t.queuePending[e]){const i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}Ag(e,t)};class Rg extends ic.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Ag("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=hc("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Ng("video",this),this.onAudioUpdateEnd_=Ng("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Og({type:"mediaSource",sourceUpdater:this,action:Pg.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Og({type:e,sourceUpdater:this,action:Pg.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?Og({type:"mediaSource",sourceUpdater:this,action:Pg.removeSourceBuffer(e),name:"removeSourceBuffer"}):ic.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!ic.browser.IE_VERSION&&!ic.browser.IS_FIREFOX&&g.MediaSource&&g.MediaSource.prototype&&"function"==typeof g.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return g.SourceBuffer&&g.SourceBuffer.prototype&&"function"==typeof g.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?Og({type:e,sourceUpdater:this,action:Pg.changeType(t),name:"changeType"}):ic.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){const{segmentInfo:i,type:s,bytes:r}=e;if(this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${r.length} until video append`);const n=t;if(Og({type:s,sourceUpdater:this,action:Pg.appendBuffer(r,i||{mediaIndex:-1},n),doneFn:t,name:"appendBuffer"}),"video"===s){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach((e=>{this.appendBuffer.apply(this,e)}))}}audioBuffered(){return Lg(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:pc()}videoBuffered(){return Lg(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:pc()}buffered(){const e=Lg(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Lg(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():vc(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=wg){Og({type:"mediaSource",sourceUpdater:this,action:Pg.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=wg){"string"!=typeof e&&(e=void 0),Og({type:"mediaSource",sourceUpdater:this,action:Pg.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=wg){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Og({type:"audio",sourceUpdater:this,action:Pg.remove(e,t),doneFn:i,name:"remove"}):i()}removeVideo(e,t,i=wg){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Og({type:"video",sourceUpdater:this,action:Pg.remove(e,t),doneFn:i,name:"remove"}):i()}updating(){return!(!xg("audio",this)&&!xg("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Og({type:"audio",sourceUpdater:this,action:Pg.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Og({type:"video",sourceUpdater:this,action:Pg.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Og({type:"audio",sourceUpdater:this,action:Pg.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Og({type:"video",sourceUpdater:this,action:Pg.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Cg.forEach((e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>Dg(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Mg=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Ug=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class Bg extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Fg extends Eg{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return pc();const e=this.subtitlesTrack_.cues;return pc([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ep(e);let s=this.initSegments_[i];if(t&&!s&&e.bytes){const t=Ug.byteLength+e.bytes.byteLength,r=new Uint8Array(t);r.set(e.bytes),r.set(Ug,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:r}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){ig(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===gm.TIMEOUT&&this.handleTimeout_(),e.code===gm.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const r=s.segment;if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof g.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));r.requested=!0;try{this.parseVTTCues_(s)}catch(Gf){return void this.stopForError({message:Gf.message})}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new g.VTTCue(e.startTime,e.endTime,e.text):e)})),sg(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof g.WebVTT)throw new Bg;"function"==typeof g.TextDecoder?t=new g.TextDecoder("utf8"):(t=g.WebVTT.StringDecoder(),i=!0);const s=new g.WebVTT.Parser(g,g.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=t=>{e.timestampmap=t},s.onparsingerror=e=>{ic.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=Mg(t)),s.parse(t)}let r=e.bytes;i&&(r=Mg(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){const s=e.segment;if(!t)return;if(!e.cues.length)return void(s.empty=!0);const r=e.timestampmap,n=r.MPEGTS/ha.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((e=>{e.startTime+=n,e.endTime+=n})),!i.syncInfo){const t=e.cues[0].startTime,r=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,r-s.duration)}}}}const jg=function(e,t){const i=e.cues;for(let s=0;s<i.length;s++){const e=i[s];if(t>=e.adStartTime&&t<=e.adEndTime)return e}return null},qg=function(e,t,i=0){if(!e.segments)return;let s,r=i;for(let n=0;n<e.segments.length;n++){const i=e.segments[n];if(s||(s=jg(t,r+i.duration/2)),s){if("cueIn"in i){s.endTime=r,s.adEndTime=r,r+=i.duration,s=null;continue}if(r<s.endTime){r+=i.duration;continue}s.endTime+=i.duration}else if("cueOut"in i&&(s=new g.VTTCue(r,r+i.duration,i.cueOut),s.adStartTime=r,s.adEndTime=r+parseFloat(i.cueOut),t.addCue(s)),"cueOutCont"in i){const[e,n]=i.cueOutCont.split("/").map(parseFloat);s=new g.VTTCue(r,r+i.duration,""),s.adStartTime=r-e,s.adEndTime=s.adStartTime+n,t.addCue(s)}r+=i.duration}},$g=86400,Vg=[{name:"VOD",run:(e,t,i,s,r)=>{if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:(e,t,i,s,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=Ic(t);r=r||0;for(let l=0;l<o.length;l++){const i=o[t.endList||0===r?l:o.length-(l+1)],s=i.segment,u=e.timelineToDatetimeMappings[s.timeline];if(!u||!s.dateTimeObject)continue;let d=s.dateTimeObject.getTime()/1e3+u;if(s.parts&&"number"==typeof i.partIndex)for(let e=0;e<i.partIndex;e++)d+=s.parts[e].duration;const h=Math.abs(r-d);if(null!==a&&(0===h||a<h))break;a=h,n={time:d,segmentIndex:i.segmentIndex,partIndex:i.partIndex}}return n}},{name:"Segment",run:(e,t,i,s,r)=>{let n=null,a=null;r=r||0;const o=Ic(t);for(let l=0;l<o.length;l++){const e=o[t.endList||0===r?l:o.length-(l+1)],i=e.segment,u=e.part&&e.part.start||i&&i.start;if(i.timeline===s&&void 0!==u){const t=Math.abs(r-u);if(null!==a&&a<t)break;(!n||null===a||a>=t)&&(a=t,n={time:u,segmentIndex:e.segmentIndex,partIndex:e.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,s,r)=>{let n=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s<t.discontinuityStarts.length;s++){const a=t.discontinuityStarts[s],o=t.discontinuitySequence+s+1,l=e.discontinuities[o];if(l){const e=Math.abs(r-l.time);if(null!==i&&i<e)break;(!n||null===i||i>=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{if(t.syncInfo){return{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}}return null}}];class Hg extends ic.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=hc("SyncController")}getSyncPoint(e,t,i,s){const r=this.runStrategies_(e,t,i,s);return r.length?this.selectSyncPoint_(r,{key:"time",value:s}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+Mc({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s){const r=[];for(let n=0;n<Vg.length;n++){const a=Vg[n],o=a.run(this,e,t,i,s);o&&(o.strategy=a.name,r.push({strategy:a.name,syncPoint:o}))}return r}selectSyncPoint_(e,t){let i=e[0].syncPoint,s=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy;for(let n=1;n<e.length;n++){const a=Math.abs(e[n].syncPoint[t.key]-t.value);a<s&&(s=a,i=e[n].syncPoint,r=e[n].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${r}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+("number"==typeof i.partIndex?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>$g)ic.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let s=i-1;s>=0;s--){const i=e.segments[s];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+s,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const r=s.dateTimeObject;s.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[s.timeline]=-r.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const s=e.segment,r=e.part;let n,a,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),n=e.startOfSegment,a=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,a=t.end+o.mapping}return r&&(r.start=n,r.end=a),(!s.start||n<s.start)&&(s.start=n),s.end=a,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let s=0;s<t.discontinuityStarts.length;s++){const r=t.discontinuityStarts[s],n=t.discontinuitySequence+s+1,a=r-e.mediaIndex,o=Math.abs(a);if(!this.discontinuities[n]||this.discontinuities[n].accuracy>o){let s;s=a<0?i.start-Mc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+Mc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:s,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class Wg extends ic.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Gg=tm(im((function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function t(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}const i=function(){const e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;const l=[],u=[];let d,h,c,p,m,g;for(n=0;n<256;n++)u[(l[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=d||1,o=u[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,s[a]=p,r[p]=a,c=l[h=l[d=l[a]]],g=16843009*c^65537*h^257*d^16843008*a,m=257*l[p]^16843008*p,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][p]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e};let s=null;class r{constructor(e){let t,r,n;s||(s=i()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];const a=this._tables[0][4],o=this._tables[1],l=e.length;let u=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");const d=e.slice(0),h=[];for(this._key=[d,h],t=l;t<4*l+28;t++)n=d[t-1],(t%l==0||8===l&&t%l==4)&&(n=a[n>>>24]<<24^a[n>>16&255]<<16^a[n>>8&255]<<8^a[255&n],t%l==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),d[t]=d[t-l]^n;for(r=0;t;r++,t--)n=d[3&r?t:t-4],h[r]=t<=4||r<4?n:o[0][a[n>>>24]]^o[1][a[n>>16&255]]^o[2][a[n>>8&255]]^o[3][a[255&n]]}decrypt(e,t,i,s,r,n){const a=this._key[1];let o,l,u,d=e^a[0],h=s^a[1],c=i^a[2],p=t^a[3];const m=a.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(g=0;g<m;g++)o=_[d>>>24]^b[h>>16&255]^v[c>>8&255]^T[255&p]^a[f],l=_[h>>>24]^b[c>>16&255]^v[p>>8&255]^T[255&d]^a[f+1],u=_[c>>>24]^b[p>>16&255]^v[d>>8&255]^T[255&h]^a[f+2],p=_[p>>>24]^b[d>>16&255]^v[h>>8&255]^T[255&c]^a[f+3],f+=4,d=o,h=l,c=u;for(g=0;g<4;g++)r[(3&-g)+n]=S[d>>>24]<<24^S[h>>16&255]<<16^S[c>>8&255]<<8^S[255&p]^a[f++],o=d,d=h,h=c,c=p,p=o}}class n extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},o=function(e,t,i){const s=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new r(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),l=new Int32Array(o.buffer);let u,d,h,c,p,m,g,f,y;for(u=i[0],d=i[1],h=i[2],c=i[3],y=0;y<s.length;y+=4)p=a(s[y]),m=a(s[y+1]),g=a(s[y+2]),f=a(s[y+3]),n.decrypt(p,m,g,f,l,y),l[y]=a(l[y]^u),l[y+1]=a(l[y+1]^d),l[y+2]=a(l[y+2]^h),l[y+3]=a(l[y+3]^c),u=p,d=m,h=g,c=f;return o};class l{constructor(e,i,s,r){const o=l.STEP,u=new Int32Array(e.buffer),d=new Uint8Array(e.byteLength);let h=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(u.subarray(h,h+o),i,s,d)),h=o;h<u.length;h+=o)s=new Uint32Array([a(u[h-4]),a(u[h-3]),a(u[h-2]),a(u[h-1])]),this.asyncStream_.push(this.decryptChunk_(u.subarray(h,h+o),i,s,d));this.asyncStream_.push((function(){r(null,t(d))}))}static get STEP(){return 32e3}decryptChunk_(e,t,i,s){return function(){const r=o(e,t,i);s.set(r,e.byteOffset)}}}var u,d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};u="undefined"!=typeof window?window:void 0!==d?d:"undefined"!=typeof self?self:{};var h=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},c=u.BigInt||Number;c("0x1"),c("0x100"),c("0x10000"),c("0x1000000"),c("0x100000000"),c("0x10000000000"),c("0x1000000000000"),c("0x100000000000000"),c("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();const p=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];h(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t};self.onmessage=function(e){const t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),s=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new l(i,s,r,(function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])}))}})));var zg=em(Gg);const Xg=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Kg=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Yg=(e,t)=>{t.activePlaylistLoader=e,e.load()},Qg=(e,t)=>()=>{const{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:r}}=t,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;a&&l&&a.id===l.id||(r.lastGroup_=a,r.lastTrack_=n,Kg(i,r),a&&!a.isMainPlaylist&&(a.playlistLoader?(i.resyncLoader(),Yg(a.playlistLoader,r)):o&&s.resetEverything()))},Jg=(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()},Zg=(e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:r},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Kg(s,n),o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;const e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;return n.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),i.pause(),r.resetEverything(),void e.fastQualityChange_(s)}if("AUDIO"===e){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l!==o.playlistLoader?(s.track&&s.track(a),s.resetEverything(),Yg(o.playlistLoader,n)):Yg(o.playlistLoader,n)}},ef={AUDIO:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s},excludePlaylist:r}=t;Kg(i,s);const n=s.activeTrack(),a=s.activeGroup(),o=(a.filter((e=>e.default))[0]||a[0]).id,l=s.tracks[o];if(n!==l){ic.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in s.tracks)s.tracks[e].enabled=s.tracks[e]===l;s.onTrackChanged()}else r({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;ic.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Kg(i,s);const r=s.activeTrack();r&&(r.mode="disabled"),s.onTrackChanged()}},tf={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ef[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ef[e](e,i))}},sf={AUDIO:(e,t)=>{const{vhs:i,sourceType:s,segmentLoaders:{[e]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:d}=t,h=Gc(d.main);a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}},h&&(a[e].main.default.playlists=d.main.playlists));for(const c in a[e]){o[c]||(o[c]=[]);for(const r in a[e][c]){let p,m=a[e][c][r];if(h?(u(`AUDIO group '${c}' label '${r}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new pp(m.playlists[0],i,n):m.resolvedUri?new pp(m.resolvedUri,i,n):m.playlists&&"dash"===s?new Kp(m.playlists[0],i,n,d):null,m=cc({id:r,playlistLoader:p},m),tf[e](e,m.playlistLoader,t),o[c].push(m),void 0===l[r]){const e=new ic.AudioTrack({id:r,kind:Xg(m),enabled:!1,language:m.language,default:m.default,label:r});l[r]=e}}}r.on("error",ef[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:s,sourceType:r,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:d}=t;for(const h in o[e]){l[h]||(l[h]=[]);for(const n in o[e][h]){if(o[e][h][n].forced)continue;let c,p=o[e][h][n];if("hls"===r)c=new pp(p.resolvedUri,s,a);else if("dash"===r){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new Kp(p.playlists[0],s,a,d)}else"vhs-json"===r&&(c=new pp(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=cc({id:n,playlistLoader:c},p),tf[e](e,p.playlistLoader,t),l[h].push(p),void 0===u[n]){const e=i.addRemoteTextTrack({id:n,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:n},!1).track;u[n]=e}}}n.on("error",ef[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const a in s[e]){r[a]||(r[a]=[]);for(const t in s[e][a]){const o=s[e][a][t];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const l=i.options_.vhs&&i.options_.vhs.captionServices||{};let u={label:t,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[u.instreamId]&&(u=cc(u,l[u.instreamId])),void 0===u.default&&delete u.default,r[a].push(cc({id:t},o)),void 0===n[t]){const e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[t]=e}}}}},rf=(e,t)=>{for(let i=0;i<e.length;i++){if(Hc(t,e[i]))return!0;if(e[i].playlists&&rf(e[i].playlists,t))return!0}return!1},nf=(e,t)=>i=>{const{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:r}}}=t,n=s.media();if(!n)return null;let a=null;n.attributes[e]&&(a=r[n.attributes[e]]);const o=Object.keys(r);if(!a)if("AUDIO"===e&&o.length>1&&Gc(t.main))for(let e=0;e<o.length;e++){const t=r[o[e]];if(rf(t,n)){a=t;break}}else r.main?a=r.main:1===o.length&&(a=r[o[0]]);return void 0===i?a:null!==i&&a&&a.filter((e=>e.id===i.id))[0]||null},af={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},of=(e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null},lf=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{sf[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=nf(i,e),t[i].activeTrack=af[i](i,e),t[i].onGroupChanged=Qg(i,e),t[i].onGroupChanging=Jg(i,e),t[i].onTrackChanged=Zg(i,e),t[i].getActiveGroup=of(i,e)}));const o=t.AUDIO.activeGroup();if(o){const e=(o.filter((e=>e.default))[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged();t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio");for(const u in t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[u])},uf=()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:wg,activeTrack:wg,getActiveGroup:wg,onGroupChanged:wg,onTrackChanged:wg,lastTrack_:null,logger_:hc(`MediaGroups[${t}]`)}})),e},df=120;let hf;const cf=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],pf=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},mf=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!s)return ic.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(s.id===e.id)return!1;const d=Boolean(yc(t,i).length);if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${u} as current playlist is live`),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const h=Cc(t,i),c=o?Yp.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Yp.MAX_BUFFER_LOW_WATER_LINE;if(a<c)return l(`${u} as duration < max low water line (${a} < ${c})`),!0;const p=s.attributes.BANDWIDTH,m=e.attributes.BANDWIDTH;if(p<m&&(!o||h<n)){let e=`${u} as next bandwidth < current bandwidth (${p} < ${m})`;return o&&(e+=` and forwardBuffer < bufferHighWaterLine (${h} < ${n})`),l(e),!0}if((!o||p>m)&&h>=r){let e=`${u} as forwardBuffer >= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${u} as no switching criteria met`),!1};class gf extends ic.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:s,bandwidth:r,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:u,cacheEncryptionKeys:d,bufferBasedABR:h,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:m}=e;null==m&&(m=1/0),hf=n,this.bufferBasedABR=Boolean(h),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.sourceType_=u,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=uf(),this.mediaSource=new g.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=pc(),this.hasPlayed_=!1,this.syncController_=new Hg(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new zg,this.sourceUpdater_=new Rg(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Wg;const f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings};this.mainPlaylistLoader_="dash"===this.sourceType_?new Kp(t,this.vhs_,this.requestOptions_):new pp(t,this.vhs_,this.requestOptions_),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Eg(cc(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Eg(cc(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Fg(cc(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){s.off("vttjserror",r),e()}function r(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",r),s.addWebVttScript_()}))}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),cf.forEach((e=>{this[e+"_"]=pf.bind(this,e)})),this.logger_=hc("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),r=s&&(s.id||s.uri),n=e.id||e.uri;r&&r!==n&&(this.logger_(`switch media ${r} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=g.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(g.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||s.length&&i[s[0]];for(const t in e)if(e[t].default){r={label:t};break}}if(!r)return t;const n=[];for(const a in i)if(i[a][r.label]){const t=i[a][r.label];if(t.playlists&&t.playlists.length)n.push.apply(n,t.playlists);else if(t.uri)n.push(t);else if(e.playlists.length)for(let i=0;i<e.playlists.length;i++){const t=e.playlists[i];t.attributes&&t.attributes.AUDIO&&t.attributes.AUDIO===a&&n.push(t)}}return n.length?n:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Vc(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),lf({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial");if(!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Vc(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{const e=this.mainPlaylistLoader_.media();if("playlist-unchanged"===e.lastExcludeReason_)return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let s=!0;const r=Object.keys(i.AUDIO);for(const n in i.AUDIO)for(const e in i.AUDIO[n]){i.AUDIO[n][e].uri||(s=!1)}s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),hf.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),n=this.tech_.buffered();return mf({buffered:n,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:df}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}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()}fastQualityChange_(e=this.selectPlaylist()){e!==this.mainPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((()=>{ic.browser.IE_VERSION||ic.browser.IS_EDGE?this.tech_.setCurrentTime(this.tech_.currentTime()+.04):this.tech_.setCurrentTime(this.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList){const e=this.seekable();if(!e.length)return!1;if(ic.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(()=>{this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0)),this.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0))}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(e=>{}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=hf.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-s<=gc;const n=r.end(r.length-1);return n-s<=gc&&i-n<=gc}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,r=s.filter(jc),n=1===r.length&&r[0]===e;if(1===s.length&&i!==1/0)return ic.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let t=!1;s.forEach((i=>{if(i===e)return;const s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(ic.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const l=t.internal?this.logger_:ic.log.warn,u=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${u} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const d=o.targetDuration/2*1e3||5e3,h="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",n||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);const r=[];(s||"audio"===e)&&r.push("AUDIO"),(s||"subtitle"===e)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const s=this[`${t}SegmentLoader_`];!s||e!==t&&"all"!==e||i.push(s)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=yc(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:hf.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const s=this.mainPlaylistLoader_.main,r=hf.Playlist.seekable(t,i,hf.Playlist.liveEdgeDelay(s,t));if(0===r.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=hf.Playlist.seekable(t,i,hf.Playlist.liveEdgeDelay(s,t)),0===e.length)return}let n,a;this.seekable_&&this.seekable_.length&&(n=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=pc([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===n&&this.seekable_.start(0)===a||(this.logger_(`seekable updated [${Tc(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){const e=this.seekable();if(!e.length)return;return void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1)))}const t=this.tech_.buffered();let i=hf.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Bm(this.main(),t),s={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||_t),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||yt}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||yt,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const n=(e,t)=>e?gt(t):ft(t),a={};let o;if(["video","audio"].forEach((function(t){if(s.hasOwnProperty(t)&&!n(e[t].isFmp4,s[t])){const i=e[t].isFmp4?"browser":"muxer";a[i]=a[i]||[],a[i].push(s[t]),"audio"===t&&(o=i)}})),r&&o&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${o} does not support codec(s): "${s.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(dt(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(dt(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}{const e=Object.keys(a).reduce(((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);const r=Bm(this.main,s),n=[];!r.audio||ft(r.audio)||gt(r.audio)||n.push(`audio codec ${r.audio}`),!r.video||ft(r.video)||gt(r.video)||n.push(`video codec ${r.video}`),r.text&&"stpp.ttml.im1t"===r.text&&n.push(`text codec ${r.text}`),n.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${n.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=Mm(dt(e)),r=Um(s),n=s.video&&dt(s.video)[0]||null,a=s.audio&&dt(s.audio)[0]||null;Object.keys(i).forEach((e=>{const s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);const o=[],l=Bm(this.mainPlaylistLoader_.main,s),u=Um(l);if(l.audio||l.video){if(u!==r&&o.push(`codec count "${u}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const e=l.video&&dt(l.video)[0]||null,t=l.audio&&dt(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),qg(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Yp.GOAL_BUFFER_LENGTH,i=Yp.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Yp.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Yp.BUFFER_LOW_WATER_LINE,i=Yp.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Yp.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Yp.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return Yp.BUFFER_HIGH_WATER_LINE}}const ff=(e,t,i)=>s=>{const r=e.main.playlists[t],n=Fc(r),a=jc(r);return void 0===s?a:(s?delete r.disabled:r.disabled=!0,s===a||n||(i(),s?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),s)};class yf{constructor(e,t,i){const{playlistController_:s}=e,r=s.fastQualityChange_.bind(s);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Bm(s.main(),t),this.playlist=t,this.id=i,this.enabled=ff(e.playlists,t.id,r)}}const _f=function(e){e.representations=()=>{const t=e.playlistController_.main(),i=Gc(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!Fc(e))).map(((t,i)=>new yf(e,t,t.id))):[]}},bf=["seeking","seeked","pause","playing","error"];class vf{constructor(e){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.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=hc("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const l=e=>{["main","audio"].forEach((t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(bf,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(bf,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach((e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&g.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&g.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=g.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),r=wc(this[`${e}Buffered_`],s);this[`${e}Buffered_`]=s,r?this.resetSegmentDownloads_(e):(this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:Ec(s)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+gc>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){i=e.end(e.length-1)}if(this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:gc)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Tc(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const s=this.playlistController_.sourceUpdater_,r=this.tech_.buffered(),n=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-mc),u=[n,a];for(let h=0;h<u.length;h++){if(!u[h])continue;if(Cc(u[h],t)<l)return!1}const d=_c(r,t);return 0!==d.length&&(i=d.start(0)+gc,this.logger_(`Buffered region starts (${d.start(0)}) just beyond seek point (${t}). Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=yc(t,e);return i.length&&e+3<=i.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const r=_c(s,t);return r.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+gc;return!i.endList&&s&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const r=yc(e,i-3),n=yc(e,i),a=yc(t,i);a.length&&!n.length&&r.length&&(s={start:r.end(0),end:a.end(0)})}else{_c(e,i).length||(s=this.gapFromVideoUnderflow_(e,i))}return!!s&&(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0)}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=_c(t,i);this.resetTimeUpdate_(),0!==s.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+mc),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){const i=bc(e);for(let s=0;s<i.length;s++){const e=i.start(s),r=i.end(s);if(t-e<4&&t-e>2)return{start:e,end:r}}return null}}const Tf={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Sf=function(e,t){let i=0,s=0;const r=cc(Tf,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const n=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*r.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(r.getSource&&"function"==typeof r.getSource)return i=Date.now(),r.getSource.call(e,a);ic.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)},u=function(t){l(),Sf(e,t)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=u},Ef=function(e){Sf(this,e)};var wf="3.0.2",kf="6.3.0",Cf="1.0.1",xf="6.0.0",If="4.0.1";const Af={PlaylistLoader:pp,Playlist:zc,utils:Ip,STANDARD_PLAYLIST_SELECTOR:Gm,INITIAL_PLAYLIST_SELECTOR:Km,lastBandwidthSelector:Gm,movingAverageBandwidthSelector:zm,comparePlaylistBandwidth:Vm,comparePlaylistResolution:Hm,xhr:fp()};Object.keys(Yp).forEach((e=>{Object.defineProperty(Af,e,{get:()=>(ic.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Yp[e]),set(t){ic.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?ic.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Yp[e]=t}})}));const Df="videojs-vhs",Lf=function(e,t){const i=t.media();let s=-1;for(let r=0;r<e.length;r++)if(e[r].id===i.id){s=r;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})},Pf=function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Lf(e,t.playlists)};Af.canPlaySource=function(){return ic.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Of=(e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Mm(dt(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);const r=mt(s.video),n=mt(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return cc(e,a)},Nf=(e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const s=t.reduce(((e,t)=>{const s=i.contentProtection[t];return s&&s.pssh&&(e[t]={pssh:s.pssh}),e}),{});return Object.keys(s).length&&e.push(s),e}),[]),Rf=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const r=i?s.concat([i]):s,n=Nf(r,Object.keys(t)),a=[],o=[];return n.forEach((t=>{o.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),a.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(a),Promise.race(o)])},Mf=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{const r=Of(t,i,s);return!!r&&(e.currentSource().keySystems=r,!(r&&!e.eme)||(ic.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Uf=()=>{if(!g.localStorage)return null;const e=g.localStorage.getItem(Df);if(!e)return null;try{return JSON.parse(e)}catch(Gf){return null}},Bf=e=>{if(!g.localStorage)return!1;let t=Uf();t=t?cc(t,e):e;try{g.localStorage.setItem(Df,JSON.stringify(t))}catch(Gf){return!1}return t},Ff=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e;Af.supportsNativeHls=function(){if(!S||!S.createElement)return!1;const e=S.createElement("video");if(!ic.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),Af.supportsNativeDash=!!(S&&S.createElement&&ic.getTech("Html5").isSupported())&&/maybe|probably/i.test(S.createElement("video").canPlayType("application/dash+xml")),Af.supportsTypeNatively=e=>"hls"===e?Af.supportsNativeHls:"dash"===e&&Af.supportsNativeDash,Af.isSupported=function(){return ic.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const jf=ic.getComponent("Component");class qf extends jf{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=hc("VhsHandler"),t.options_&&t.options_.playerId){const e=ic.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(S,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=S.fullscreenElement||S.webkitFullscreenElement||S.mozFullScreenElement||S.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=Uf();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Yp.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Yp.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=Ff(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Af,this.options_.sourceType=Tt(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new gf(this.options_);const i=cc({liveRangeSafeTimeDelta:gc},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vf(i),this.playlistController_.on("error",(()=>{const e=ic.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const s=this.options_.bufferBasedABR?Af.movingAverageBandwidthSelector(.55):Af.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=Af.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=g.navigator.connection||g.navigator.mozConnection||g.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const s=1e3*t.downlink*1e3;e=s>=i&&e>=i?Math.max(e,s):s}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;t=this.throughput>0?1/this.throughput:0;return Math.floor(1/(e+t))},set(){ic.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:()=>Ec(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:()=>Ec(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&&Bf({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{_f(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_=g.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Rf({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=Mf({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"!==e.status)return;const t=this.playlistController_.main();if(!t||!t.playlists)return;const i=[];t.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,i.push(e))})),i.length&&(ic.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...i),this.playlistController_.fastQualityChange_())})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==ic.browser.IE_VERSION&&t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=ic.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{Pf(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Lf(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":wf,"mux.js":kf,"mpd-parser":Cf,"m3u8-parser":xf,"aes-decrypter":If}}version(){return this.constructor.version()}canChangeType(){return Rg.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_&&g.URL.revokeObjectURL&&(g.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Mp({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Up({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}const $f={name:"videojs-http-streaming",VERSION:wf,canHandleSource(e,t={}){const i=cc(ic.options,t);return $f.canPlayType(e.type,i)},handleSource(e,t,i={}){const s=cc(ic.options,i);return t.vhs=new qf(e,t,s),t.vhs.xhr=fp(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=Tt(e);if(!i)return"";const s=$f.getOverrideNative(t);return!Af.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(ic.browser.IS_ANY_SAFARI||ic.browser.IS_IOS),{overrideNative:s=i}=t;return s}};(()=>gt("avc1.4d400d,mp4a.40.2"))()&&ic.getTech("Html5").registerSourceHandler($f,0),ic.VhsHandler=qf,ic.VhsSourceHandler=$f,ic.Vhs=Af,ic.use||ic.registerComponent("Vhs",Af),ic.options.vhs=ic.options.vhs||{},ic.getPlugin&&ic.getPlugin("reloadSourceOnError")||ic.registerPlugin("reloadSourceOnError",Ef);const Vf="application/x-mpegURL";let Hf=class extends t{constructor(){super(),this._defaultConfigs={autoplay:!1,fluid:!1,fullscreen:!1,loop:!1,muted:!1,preload:"auto",responsive:!1,startTime:0},this.cameraSensorModel=null,this.currentMetadata=null,this.element=null,this.state="not-ready",this.waitingTimestamp=null,this._initController=()=>{!this._controller&&this.sourceUrl&&(this.element=document.createElement("video"),this._controller=ic(this.element,this._defaultConfigs),this._controller.muted(this.muted),this._controller.loop(this.loop),this._controller.playbackRate(this.rate),this.addHandles([this._controller.ready(this._handleReady),this._controller.on("canplay",this._handleCanPlay),this._controller.on("durationchange",this._handleDurationChange),this._controller.on("ended",this._handleEnded),this._controller.on("error",this._handleError),this._controller.on("loadeddata",this._handleDataLoaded),this._controller.on("loadedmetadata",this._handleLoadedMetadata),this._controller.on("loadstart",this._handleLoadStart),this._controller.on("play",this._handlePlay),this._controller.on("timeupdate",this._handleTimeUpdate),this._controller.on("waiting",this._handleWaiting)]))},this._handleReady=()=>{this.state="ready"},this._handleCanPlay=()=>this.state="can-play",this._handleCueChange=()=>{if(!this.subtitleTrack?.activeCues?.length)return;const e=this.subtitleTrack?.activeCues[0],t=e.text?JSON.parse(e.text):null,i=t?.Data[0]?.Value;if(!i.length)return;const s=new Map;for(const r of i){if(Array.isArray(r.Value)){r.Value.forEach((e=>{s.set(e.TagUID,e)}))}else s.set(r.TagUID,r)}s.set(d.EsriVideoWidth,{Name:"Video Width",TagUID:d.EsriVideoWidth,Value:this._controller.videoWidth()}),s.set(d.EsriVideoHeight,{Name:"Video Height",TagUID:d.EsriVideoHeight,Value:this._controller.videoHeight()}),this.currentMetadata=new Map(s),this.cameraSensorModel=new u({videoMetadata:this.currentMetadata})},this._handleDataLoaded=()=>{},this._handleDurationChange=()=>this.notifyChange("duration"),this._handleEnded=()=>{if(!this.loop)return this._set("ended",!0),this.notifyChange("buffered"),this.notifyChange("currentTime"),this.notifyChange("duration"),this.notifyChange("waiting"),void(this.state="can-play");this.setCurrentTime(0),this.play()},this._handleError=()=>{i.getLogger(this).error("video stream error ::",this._controller?.error())},this._handleLoadStart=()=>{this.state="can-play"},this._handleLoadedMetadata=()=>{this.notifyChange("subtitleTrack"),this.notifyChange("buffered")},this._handlePlay=()=>this.notifyChange("ended"),this._handleTimeUpdate=()=>{this.notifyChange("currentTime"),this.notifyChange("buffered"),this.notifyChange("bufferedPercent")},this._handleWaiting=()=>this.waitingTimestamp=this._controller?.currentTime()}initialize(){this.addHandles([r((()=>this.sourceUrl),(e=>{e&&(this._initController(),this._controller.src({type:Vf,src:this.sourceUrl}))}),n),r((()=>this.subtitleTrack),(()=>{this.subtitleTrack&&(this.subtitleTrack.mode="showing")}))]),this.addHandles(a((()=>this.subtitleTrack),"cuechange",this._handleCueChange))}destroy(){this._controller&&this._controller.dispose()}get buffered(){return this._controller?.bufferedEnd()??0}get bufferedPercent(){return this._controller?.bufferedPercent()??0}get currentTime(){return this._controller?.currentTime()??0}get duration(){return this._controller?.duration()??0}get ended(){return this._controller?.ended()??this._get("ended")??!0}set ended(e){this._controller?.ended(e),this._set("ended",e)}get loop(){return this._controller?.loop()??this._get("loop")??!1}set loop(e){this._controller?.loop(e),this._set("loop",e)}get muted(){return this._controller?.muted()??this._get("muted")??!1}set muted(e){this._controller?.muted(e),this._set("muted",e)}get rate(){return this._controller?.playbackRate()??this._get("rate")??1}set rate(e){this._controller?.playbackRate(e),this._set("rate",e)}get sourceUrl(){return this._controller?.src()}set sourceUrl(e){this._set("sourceUrl",e)}get started(){return this._controller?.hasStarted()}get subtitleTrack(){const e=this._controller?.textTracks();return e?.length?Array.from(e).find((e=>"subtitles"===e.kind)):null}get waiting(){return!this.waitingTimestamp&&(this.waitingTimestamp===this.currentTime||(this.waitingTimestamp=null,!1))}pause(){this._controller?.pause(),this.state="paused"}play(){this._controller?.play(),this.state="playing"}reset(){this._controller&&(this.pause(),this.setCurrentTime(0),this._set("ended",!0))}setCurrentTime(e){const t=s(e,0,this.duration);this._controller?.currentTime(t),this.notifyChange("currentTime")}};e([o()],Hf.prototype,"buffered",null),e([o()],Hf.prototype,"bufferedPercent",null),e([o()],Hf.prototype,"cameraSensorModel",void 0),e([o({readOnly:!0})],Hf.prototype,"currentTime",null),e([o()],Hf.prototype,"currentMetadata",void 0),e([o({readOnly:!0})],Hf.prototype,"duration",null),e([o()],Hf.prototype,"element",void 0),e([o({readOnly:!0})],Hf.prototype,"ended",null),e([o()],Hf.prototype,"loop",null),e([o()],Hf.prototype,"muted",null),e([o()],Hf.prototype,"rate",null),e([o()],Hf.prototype,"sourceUrl",null),e([o({readOnly:!0})],Hf.prototype,"started",null),e([o()],Hf.prototype,"state",void 0),e([o()],Hf.prototype,"subtitleTrack",null),e([o({readOnly:!0})],Hf.prototype,"waiting",null),e([o()],Hf.prototype,"waitingTimestamp",void 0),Hf=e([l("esri.layers.video.VideoController")],Hf);const Wf=Hf;export{Wf as default};
|